I've read many other pages on this error, but none have helped me.
I'm getting the following exception when using a DataGridViewComboBoxColumn:
System.FormatException: DataGridViewComboBoxCell value is not valid
Using vs 2008 sp1
This code here works
DataGridViewComboBoxColumn combCol1 = new DataGridViewComboBoxColumn(); combCol1.HeaderText = "Application"; combCol1.Name = "Application"; combCol1.DataSource = ds.Application; combCol1.DisplayMember = ds.Application.NameColumn.ToString(); combCol1.ValueMember = ds.Application.IdColumn.ToString(); dgvMain.Columns.Add(combCol1);
But now I hit a problem
I also want to display what is currently set in the database for that row, so I've done this:
int rowCount = dgvMain.Rows.Count - 1; // subtract 1 because DataGridView automatically adds a blank row at the bottomfor (int i = 0; i < rowCount; i++) { dgvMain.Rows[i].Cells["Application"].Value = "test"; }
And when I move my mouse over the dropdown, the message comes up many times again
What's going on? :(