System.Data Namespace DataColumnCollection Class
Clears the collection of any columns.
[ VB ]
Public Sub Clear ( )
[ C# ]
public void Clear ( );
[ C++ ]
public: void Clear ( );
[ JScript ]
public function Clear ( );
Use this method to remove all DataColumn objects from the Columns collection of a specified table. To remove a particular DataColumn from the collection, use the Remove method.
This method resets the Columns.Count property to 0.
If the collection is succesfully changed by adding or removing columns, the CollectionChanged event occurs.
The following example gets the DataColumnCollection of a given DataTable, then clears the collection.
private void ClearColumns ( DataTable dt ) {
DataColumnCollection myCols = dt.Columns;
myCols.Clear ( );
}
Private Sub ClearColumns ( ByVal dt As DataTable )
Dim myCols As DataColumnCollection = dt.Columns
myCols.Clear ( )
End Sub |
|
C# |
VB |
DataColumnCollection Members