System.Data Namespace DataRowCollection Class
Returns a row at the specified index.
DataRow variable = DataRowCollection.Item [ rowIndex ];
... or ...
DataRow variable = DataRowCollection [ rowIndex ];
dim variable as DataRow = DataRowCollection.Item ( rowIndex )
... or ...
dim variable as DataRow = DataRowCollection ( rowIndex )
variable : DataRow = DataRowCollection.Item ( rowIndex );
... or ...
variable : DataRow = DataRowCollection ( rowIndex ); |
|
C# |
VB |
JScript |
- rowIndex
- The zero-based index of the row to return.
The specified DataRow.
Exception Type |
Condition |
IndexOutOfRangeException |
Occurs when the index value is greater than the number of items in the collection. |
Use this indexer to get a DataRow object from the DataRowCollection at the specified index using array notation.
The below snippet shows how to use the Item property to programmatically set the index of the DataRow to access, based on the selected item in a templated control.
DataRow myRow = myTable.Rows [ .Item.ItemIndex ];
dim myRow as DataRow = myTable.Rows ( e.Item.ItemIndex ) |
|
C# |
VB |
The following examples demonstrate use of the Item property to return the row at the specified index in a DataRowCollection.
DataRowCollection Members Contains