DataTableCollection.Clear Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Efface la collection de tous les DataTable objets.
public:
void Clear();
public void Clear();
member this.Clear : unit -> unit
Public Sub Clear ()
Exemples
L’exemple suivant obtient l’objet DataTableCollection d’un DataSet, puis efface la collection de toutes les 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();
}
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.
tables.Clear
End Sub
Remarques
Pour supprimer un particulier DataTable de la collection, utilisez la Remove méthode.