System.Windows.Forms.DataGridViewCell.ErrorText Property

Gets or sets the text describing an error condition associated with the cell.


public string ErrorText { set; get; }


Documentation for this section has not yet been entered.


Typically, the DataGridViewCell.ErrorText property is used when handling the DataGridView.CellValidating event of the System.Windows.Forms.DataGridView. If the cell's value fails some validation criteria, set the DataGridViewCell.ErrorText property and cancel the commit operation by setting the System.ComponentModel.CancelEventArgs.Cancel property of the System.Windows.Forms.DataGridViewCellValidatingEventArgs to true. The text you specify is then displayed by the System.Windows.Forms.DataGridView, and the user is prompted to fix the error in the cell's data.

When the DataGridView.VirtualMode property of the System.Windows.Forms.DataGridView is true, you can provide error text for rows and cells using the DataGridView.RowErrorTextNeeded and DataGridView.CellErrorTextNeeded events.

When you assign a different DataGridViewCell.ErrorText string to a cell, the DataGridView.CellErrorTextChanged event of the System.Windows.Forms.DataGridView control is raised.


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