System.Windows.Forms.DataGridViewCellValidatingEventArgs Class

Provides data for the DataGridView.CellValidating event of a System.Windows.Forms.DataGridView control.

See Also: DataGridViewCellValidatingEventArgs Members


public class DataGridViewCellValidatingEventArgs : System.ComponentModel.CancelEventArgs


The DataGridView.CellValidating event lets you cancel changes to the current cell when the new value is not valid. Use the DataGridViewCellValidatingEventArgs.FormattedValue property to determine the current value. To determine the state of the current cell, use the DataGridViewCellValidatingEventArgs.RowIndex and DataGridViewCellValidatingEventArgs.ColumnIndex properties to access the cell through the DataGridView.Rows collection. To cancel the change, set the System.ComponentModel.CancelEventArgs.Cancel property to true.

When this event is canceled in data-bound mode, the new value is not pushed to the underlying data source. When this event is canceled in virtual mode, the DataGridView.CellValuePushed event will not be raised.


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