Gets or sets the number of a row in the DataGrid control.
[Visual Basic] Public Property RowNumber As Integer [C#] public int RowNumber {get; set;} [C++] public: __property int get_RowNumber(); public: __property void set_RowNumber(int); [JScript] public function get RowNumber() : int; public function set RowNumber(int);
The number of the row.
The RowNumber value can be used to specify a DataRow object in the DataTable associated with the DataGrid control.
The following example assigns the CurrentCell property of a DataGrid to a DataGridCell and returns the value stored in the DataTable object's RowNumber and ColumnNumber properties.
[Visual Basic]
Private Sub PrintCell() Dim myCell As DataGridCell ' Set the variable to the selected cell. myCell = DataGrid1.CurrentCell ' Get the value of the selected cell through the DataTable. Dim t As DataTable t = DataGrid1.CurrentGridTable.DataTable Console.WriteLine(t.Rows(myCell.RowNumber)(myCell.ColumnNumber)) End Sub
DataGridCell Structure | DataGridCell Members | System.WinForms Namespace