NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

TablesCollection.Contains (String)

Checks if a table, specified by name, exists in the collection.

[Visual Basic]
Overloads Public Function Contains( _
   ByVal name As String _
) As Boolean
[C#]
public bool Contains(
   string name
);
[C++]
public: bool Contains(
   String* name
);
[JScript]
public function Contains(
   name : String
) : Boolean;

Parameters

name
The table name to check for.

Return Value

true if the specified table exists; otherwise, false.

Remarks

The DataTable object's name is specified by the TableName property. If you add a DataTable to the TablesCollection with the Add method, passing no arguments, the table is given a default name such as Table1, Table2, and so on.

To get the index of a DataTable, use the IndexOf method.

Example [Visual Basic]

The following example tests whether a table with the name "Suppliers" exists in the TablesCollection.

[Visual Basic]

Private Sub TestForTableName()
   Dim dSet As DataSet
   ' Get the DataSet of a DataGrid.
   Set dSet = DataGrid1.DataGridTable.DataTable.DataSet
   ' Get the TablesCollection through the Tables property.
   Dim tablesCol As TablesCollection
   Set tablesCol = dSet.Tables
   ' Check if the named table exists.
   If tablesCol.Contains("Suppliiers") Then 
      MessageBox "Table named Suppliers exists"
   Ene If
End Sub

See Also

TablesCollection Class | TablesCollection Members | System.Data Namespace | TablesCollection.Contains Overload List | Item | IndexOf | Remove | CanRemove