Reputation: 1814
I am not sure how to populate a DatagridviewComboboxcolumn. There are several properties in the DataGridViewComboboxcolumn, and i am not sure which to use:
I am confused there are that many properties. This is what I tried:
DataGridViewComboBoxColumn cb = (DataGridViewComboBoxColumn)dataGridView1.Rows[0].Cells[0].Value;
cb.Items.Add("TEST");
//OR
cb.DataSource = new List<String>() { "T", "E", "S", "T" };
Upvotes: 0
Views: 310
Reputation: 997
You have to cast it to DataGridViewComboBoxCell
, not DataGridViewComboBoxColumn
:) For example:
((DataGridViewComboBoxCell)dataGridView1.Rows[0].Cells[0]).Items.Add("Something");
Upvotes: 1