asp.net.ph

DataColumnCollection.Clear Method

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 ( );

Remarks

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.

Example

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 ( );
}
  C# VB

See Also

DataColumnCollection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph