Gets the row at the specified index.
[C#] In C#, this member is the indexer for the RowsCollection class.
[Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As DataRow [C#] public DataRow this[ int index ] {get;} [C++] public: __property DataRow* get_Item( int index ); [JScript] returnValue = RowsCollectionObject.Item(index); -or- returnValue = RowsCollectionObject(index);
[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed Item property whose type is Object and whose index type is String.
The specified DataRow.
Exception Type | Condition |
---|---|
IndexOutOfRangeException | There is no row at the specified index. |
The Contains method is used determine if any rows in the collection contains a specified value.
The following example prints the value of column 1 in a DataRow object. The example uses the RowsCollection object's Item property (RowsCollection indexer) to specify which row to print.
[Visual Basic]
Private Sub GetRowAtIndex(i As Integer) Dim rc As RowsCollection Set rc = DataGrid1.DataGridTable.DataTable.Rows Dim row As DataRow Set row = rc(DataGrid1.CurrentCell.RowNumber) edit1.Text = row(i) End Sub
RowsCollection Class | RowsCollection Members | System.Data Namespace | Contains