Answers for "datagridview combobox cell value is not valid how to fix"

0

datagridview combobox cell value is not valid how to fix

if (e.Exception.Message == "DataGridViewComboBoxCell value is not valid.")
            {
                object value = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                if (!((DataGridViewComboBoxColumn)dataGridView1.Columns[e.ColumnIndex]).Items.Contains(value))
                {
                    ((DataGridViewComboBoxColumn)dataGridView1.Columns[e.ColumnIndex]).Items.Add(value);
                    e.ThrowException = false;
                }
            }
Posted by: Guest on November-16-2020

Code answers related to "datagridview combobox cell value is not valid how to fix"

Browse Popular Code Answers by Language