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.IndexOf (String)

Returns the index of the table with the given name (case insensitive), or-1 if the table doesn't exist in the collection.

[Visual Basic]
Overloads Overridable Public Function IndexOf( _
   ByVal tableName As String _
) As Integer
[C#]
public virtual int IndexOf(
   string tableName
);
[C++]
public: virtual int IndexOf(
   String* tableName
);
[JScript]
public function IndexOf(
   tableName : String
) : int;

Parameters

tableName
The name to look for.

Return Value

The index of the table with the name, or-1 if the table doesn't exist in the collection.

Remarks

The name of a DataTable is set with the TableName property.

Example [Visual Basic]

The following example returns the index of a named table in the TablesCollection.

[Visual Basic]

Private Sub GetIndexes()
   Dim dSet As DataSet
   Dim tablesCol As TablesCollection
   ' Get the DataSet of a DataGrid.
   Set dSet = DataGrid1.DataGridTable.DataTable
   ' Get the TablesCollection through the Tables property.
   Set tablesCol = dSet.Tables
   ' Get the index of the table named "Authors", if it exists.
   If tablesCol.Contains("Authors") Then
      Debug.Print tablesCol.IndexOf("Authors")
   End If
End Sub

See Also

TablesCollection Class | TablesCollection Members | System.Data Namespace | TablesCollection.IndexOf Overload List | IndexOf | TableName | Remove