DataGridViewCellEventArgs.RowIndex Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a value indicating 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 index of the row containing the cell 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: