asp.net.ph

DataColumnCollection.IndexOf Method

System.Data Namespace   DataColumnCollection Class


Returns the index of the specified DataColumn.

Overload List

Returns the index of a specified DataColumn object.

Returns the index of a DataColumn with the specified name.


Example

The following example returns the index of a named column in a DataColumnCollection.

NOTE: This example uses one of the overloaded versions of IndexOf. For other examples that may be available, see the individual overload topics.

private void GetIndexes ( DataTable myTable ) {
   DataColumnCollection myCols = myTable.Columns;
   // get the index of the column named "City", if it exists.
   if ( myCols.Contains ( "City" ) ) {
      Response.Write ( myCols.IndexOf ( "City" ) );
   }
}
  C# VB

See Also

DataColumnCollection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph