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

Returns the index of a specified table.

Overload List

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(String) As Integer
[C#] public virtual int IndexOf(String);
[C++] public: virtual int IndexOf(String*);
[JScript] public function IndexOf(String) : int;

Returns the index of a specified DataTable.

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

Example [Visual Basic]

The following example returns the index of each table in the TablesCollection.

Note   This example shows how to use one of the overloaded versions of IndexOf. For other examples that may be available, see the individual overload topics.

[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
   Dim t As DataTable
   ' Get the index of each table in the collection.
   For Each t In tablesCol
      Debug.Print tablesCol.IndexOf(t)
   Next
End Sub

See Also

TablesCollection Class | TablesCollection Members | System.Data Namespace