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];
}
}