DataGridCell.RowNumber Proprietà

Definizione

Ottiene o imposta il numero di una riga nel controllo DataGrid.

C#
public int RowNumber { get; set; }

Valore della proprietà

Int32

Numero della riga.

Esempio

Nell'esempio seguente viene assegnata la CurrentCell proprietà di un System.Windows.Forms.DataGrid a DataGridCell e restituisce il valore archiviato nelle DataTable proprietà e ColumnNumber dell'oggettoRowNumber.

C#
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]);
   Console.WriteLine(myDataGridCell.RowNumber);
}

Commenti

È possibile usare il RowNumber valore per specificare un DataRow oggetto nell'oggetto DataTable associato al System.Windows.Forms.DataGrid controllo.

Si applica a

Prodotto Versioni
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0