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;
The index of the table with the name, or-1 if the table doesn't exist in the collection.
The name of a DataTable is set with the TableName property.
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
TablesCollection Class | TablesCollection Members | System.Data Namespace | TablesCollection.IndexOf Overload List | IndexOf | TableName | Remove