Occurs when an external data-parsing or validation operation throws an exception, or when an attempt to commit data to a data source fails.
The DataGridView.DataError event enables you to handle exceptions thrown in code that is called by the control during data processing operations.
For more information about handling events, see Consuming Events.
The DataGridViewCellCancelEventArgs.ColumnIndex and DataGridViewCellCancelEventArgs.RowIndex properties of the System.Windows.Forms.DataGridViewDataErrorEventArgs object associated with this event normally indicate the cell in which the data error occurred. When the error occurs in an external data source, however, the data source may not provide the column in which the error occurred. In this case, the DataGridViewCellCancelEventArgs.ColumnIndex property typically indicates the column of the current cell at the time of the error.