dataGridView.Rows.Add(
metaData.Offset.ToString("X2"),
metaData.Length,
metaData.Format, // This parameter goes to a ComboBox cell which throws an
metaData.Description, // exception above
null,
null);
What is the valid way to programmatically assign data to DataGridViewComboBoxCell
?
To Solve this problem, just add “DataError” for DataGridView. That’s all, steps: Double click the datagridview and select the “dataerror” event from the event list.
The DataError event enables you to handle exceptions thrown in code that is called by the control during data processing operations.
thats it :)
To Solve this problem, add event of "DataError" for DataGridView and then
just write this: e.Cancel = true;
e.g:
private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
e.Cancel = true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With