After setting the values in the DataGridView, they don't show up on the control even though I can access them through the Value property.
The problem is that there is no default Value in the ComboBox cells.
void ComboBoxColumn()
{
string[] values = { "one", "two", "three" };
string columnName = "Test";
var column = new DataGridViewComboBoxColumn();
column.Name = columnName;
column.ValueType = typeof(string);
foreach(string item in values)
{
column.Items.Add(item);
}
Grid.Columns.Add(column);
// problematic part
foreach(DataGridViewRow row in Grid.Rows)
{
row.Cells[columnName].Value = values[0];
}
}
On my machine this code is running. If I click the ComboBoxColumn I can see the tree values and choose one. What is your problem?
If you add this code, the default value of the combo box shows the value 'two'.