I am having weird results in my DataGridViewComboBoxColumn.
1) When there is no value set, and I click on the cell (not the drop down arrow) the first value in the options shows as the value, and when I click off the cell, it returns back to blank value. This is misleading as there was no value chosen, yet it shows the first value until you click off the cell.
One solution was to make the first option blank, however then I am still afflicted by the next issue...
2) If I select a cell that already has a value, then select a cell that does not, the value that was originally selected will show in the cell that has no value selected. Again, clicking off the cell will clear it, however, it is misleading again.
I would like to make this not misleading ... anyone know of a solution?
DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn();
DataTable dt = new DataTable();
dt.Columns.Add("f_Id");
dt.Columns[0].DataType = typeof(string);
dt.Columns.Add("f_Desc");
dt.Columns[1].DataType = typeof(string);
for (int i = 0; i < values.Count(); i++)
{
dt.Rows.Add(values[i], values[i]);
}
col.DataSource = dt;
col.DisplayMember = dt.Columns[1].ColumnName;
col.ValueMember = dt.Columns[0].ColumnName;
col.HeaderText = header;
col.Name = header;
DataGridView1.Columns.Add(col);