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!

ColumnsCollection.Remove (String)

Removes the column with the specified name from the collection.

[Visual Basic]
Overloads Public Sub Remove( _
   ByVal name As String _
)
[C#]
public void Remove(
   string name
);
[C++]
public: void Remove(
   String* name
);
[JScript]
public function Remove(
   name : String
);

Parameters

name
The name of the column to remove.

Exceptions

Exception Type Condition
IndexOutOfRangeException The collection doesn't have a column with the specified name.

Remarks

If the collection is succesfully changed by adding or removing columns, the OnCollectionChanged event occurs.

Example [Visual Basic]

The following example first uses the Contains method to determine if a particular column is found in the collection. If it is found, the CanRemove method tests whether the column can be removed. If so, the column is removed with the Remove method.

[Visual Basic]

Private Sub RemoveColumnByName(colName As String)
   Dim cols As ColumnsCollection
   ' Get the ColumnsCollection from a DataTable in a DataSet.
   cols = DataSet1.Tables("Orders").Columns
   If cols.Contains(colName) Then 
      If cols.CanRemove(cols(colName)) Then cols.Remove(colName)
   End If
End If

See Also

ColumnsCollection Class | ColumnsCollection Members | System.Data Namespace | ColumnsCollection.Remove Overload List | Contains