Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Clear Method

DataTableCollection.Clear Method

Clears the collection of all DataTable objects.

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

public void 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 void ClearTables()
{
    // Get the DataSet of a DataGrid control.
    DataSet dataSet = (DataSet)DataGrid1.DataSource;
    DataTableCollection tables = dataSet.Tables;

    // Clear the collection.
    tables.Clear();
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
Show:
© 2015 Microsoft