Clear Method
Collapse the table of content
Expand the table of content

DataTableCollection.Clear Method ()


Clears the collection of all DataTable objects.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

Public Sub Clear

To remove a particular DataTable from the collection, use the Remove method.

The following example gets the DataTableCollection of a DataSet, and then clears the collection of all tables.

Private Sub ClearTables()
   ' Get the DataSet of a DataGrid control.
   Dim dataSet As DataSet = CType(DataGrid1.DataSource, DataSet)
   Dim tables As DataTableCollection = dataSet.Tables

   ' Clear the collection.
End Sub

.NET Framework
Available since 1.1
Return to top
© 2016 Microsoft