System.ArgumentException: DataGridViewComboBoxCell value is not valid

LEMUEL  ADANE picture LEMUEL ADANE · Jan 21, 2011 · Viewed 17.8k times · Source
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?

Answer

suresh picture suresh · Feb 4, 2012

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 :)