NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataRow.SetColumnError (DataColumn, String)

Sets the error description for a column specified as a DataColumn.

[Visual Basic]
Overloads Public Sub SetColumnError( _
   ByVal column As DataColumn, _
   ByVal error As String _
)
[C#]
public void SetColumnError(
   DataColumn column,
   string error
);
[C++]
public: void SetColumnError(
   DataColumn* column,
   String* error
);
[JScript]
public function SetColumnError(
   column : DataColumn,
   error : String
);

Parameters

column
The DataColumn to set the error description for.
error
The error description.

Remarks

To examine error descriptions, use the GetColumnError method.

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

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

To determine if any errors exist for the columns collection, use the HasErrors method.

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

Example [Visual Basic]

The following example sets and gets the error description for a new column in an existing System.WinForms.DataGrid control's DataTable.

[Visual Basic]

Dim myRow As DataRow
Dim t As DataTable
Dim c As DataColumn
t = DataGrid1.DataGridTable.DataTable
' Get the column from the existing column collection.
c = t.Columns(0)
myRow = t.NewRow
Dim ErrorString As String
ErrorString = "Replace this text."
' Use DataColumn.Contains to ensure the column exists
If myRow.DataTable.Columns.Contains(c.ColumnName) Then
   myRow.SetColumnError c, ErrorString
   Console.WriteLine(myRow.GetColumnError(c))
   ' Add the row
   t.Rows.Add(myRow)
End If

See Also

DataRow Class | DataRow Members | System.Data Namespace | DataRow.SetColumnError Overload List | ClearErrors | ColumnsCollection | Contains | DataColumn | Error | GetColumnsInError | HasErrors | RowError