Error: "DataGridViewComboBoxCell value is not valid." DataSource is list of basic type
I found the answer here. It's also mentioned in this answer to the second link in my question. When setting the DataSource
to a list of anything that's not a string, set the ValueType
of the column to typeof(<your data type>)
IList<double> kvChoices;
// Populate kvChoices...
DataGridViewComboBoxColumn kvCol =
dataGridView1.Columns[0] as DataGridViewComboBoxColumn;
kvCol.DataSource = kvChoices;
kvCol.ValueType = typeof(double);