The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGridCell.RowNumber Property

Gets or sets the number of a row in the System.Windows.Forms.DataGrid control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public int RowNumber { get; set; }
/** @property */
public int get_RowNumber ()

/** @property */
public void set_RowNumber (int value)

public function get RowNumber () : int

public function set RowNumber (value : int)

Not applicable.

Property Value

The number of the row.

You can use the RowNumber value to specify a DataRow in the DataTable associated with the System.Windows.Forms.DataGrid control.

The following example assigns the CurrentCell property of a System.Windows.Forms.DataGrid to a DataGridCell and returns the value stored in the DataTable object's RowNumber and ColumnNumber properties.

private void PrintCell(object sender, MouseEventArgs e)
   DataGrid thisGrid = (DataGrid) sender;
   DataGridCell myDataGridCell = thisGrid.CurrentCell;
   BindingManagerBase bm = BindingContext[thisGrid.DataSource, thisGrid.DataMember];
   DataRowView drv = (DataRowView) bm.Current;
   Console.WriteLine(drv [myDataGridCell.ColumnNumber]);

private void PrintCell(Object sender, MouseEventArgs e)
    DataGrid thisGrid = (DataGrid)(sender);
    DataGridCell myDataGridCell = thisGrid.get_CurrentCell();
    BindingManagerBase bm = get_BindingContext().
    DataRowView drv = (DataRowView)(bm.get_Current());
} //PrintCell

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0