即使组合框填充了许多值,默认情况下组合框也会显示空白字段
ColumnSpeed.DataSource = speedList;
ColumnSpeed.ValueType = typeof(string);
我也尝试了以下方法,但它仍然显示空白文本。
foreach (DataGridViewRow row in myDataGridView.Rows)
{
DataGridViewComboBoxCell cell = row.Cells[ColumnSpeed.Index] as DataGridViewComboBoxCell;
if (cell != null)
{
cell.DataSource = speedList;
cell.Value = cell.Items[0].ToString();
}
}