System.Windows.Forms.DataGridViewDataErrorEventArgs Class

Provides data for the DataGridView.DataError event.

See Also: DataGridViewDataErrorEventArgs Members

Syntax

public class DataGridViewDataErrorEventArgs : DataGridViewCellCancelEventArgs

Remarks

Handling the DataGridView.DataError event lets you handle exceptions thrown by code outside your control (for example, by an external data source). Use the DataGridViewDataErrorEventArgs.Context property to determine the state of the System.Windows.Forms.DataGridView at the time of the exception. Use the DataGridViewDataErrorEventArgs.Exception property to retrieve the exception data. If you want to handle the exception by additional event handlers, set the DataGridViewDataErrorEventArgs.ThrowException property to true.

The DataGridViewCellCancelEventArgs.ColumnIndex and DataGridViewCellCancelEventArgs.RowIndex properties 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.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0