Returns the index of a specified table.
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;
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
TablesCollection Class | TablesCollection Members | System.Data Namespace