System.Data.DataRow.SetColumnError Method

Sets the error description for a column specified by index.

Syntax

public void SetColumnError (int columnIndex, string error)

Parameters

columnIndex
The zero-based index of the column.
error
The error description.

Remarks

The method is used to set custom error descriptions on specified columns. You can use the System.Windows.Forms.ErrorProvider control to display the text of the error.

To examine error descriptions, use the DataRow.GetColumnError(int) method.

To determine whether any errors exist for the columns collection, use the DataRow.HasErrors property. Consequently, you can use the DataRow.GetColumnsInError method to retrieve all the columns with errors.

If null or an empty string is passed in as the error parameter, the System.Data.DataRow behaves as if no error was set and the DataRow.HasErrors property will return false.

To set a custom error description on the whole row, use the DataRow.RowError property.

To clear all errors for the columns collection, use the DataRow.ClearErrors method.

To set error text that applies to a whole row, set the DataRow.RowError property.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0