DataGridViewCellCancelEventArgs.RowIndex Property

 

Gets the row index of the cell that the event occurs for.

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

public int RowIndex { get; }

Property Value

Type: System.Int32

The row index of the DataGridViewCell that the event occurs for.

The following code example illustrates the use of this property.

private void dataGridView1_CellBeginEdit(object sender,
    DataGridViewCellCancelEventArgs e)
{
    string msg = String.Format("Editing Cell at ({0}, {1})",
        e.ColumnIndex, e.RowIndex);
    this.Text = msg;
}

private void dataGridView1_CellEndEdit(object sender,
    DataGridViewCellEventArgs e)
{
    string msg = String.Format("Finished Editing Cell at ({0}, {1})",
        e.ColumnIndex, e.RowIndex);
    this.Text = msg;
}

.NET Framework
Available since 2.0
Return to top
Show: