DataGridViewCellEventArgs.RowIndex DataGridViewCellEventArgs.RowIndex DataGridViewCellEventArgs.RowIndex DataGridViewCellEventArgs.RowIndex Property

定义

获取一个值,此值指示发生此事件的单元格的行索引。Gets a value indicating the row index of the cell that the event occurs for.

public:
 property int RowIndex { int get(); };
public int RowIndex { get; }
member this.RowIndex : int
Public ReadOnly Property RowIndex As Integer

属性值

行的索引,该行包含发生此事件的单元格。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;
}
Private Sub dataGridView1_CellBeginEdit(ByVal sender As Object, _
    ByVal e As DataGridViewCellCancelEventArgs) _
    Handles DataGridView1.CellBeginEdit

    Dim msg As String = _
        String.Format("Editing Cell at ({0}, {1})", _
        e.ColumnIndex, e.RowIndex)
    Me.Text = msg

End Sub

Private Sub dataGridView1_CellEndEdit(ByVal sender As Object, _
    ByVal e As DataGridViewCellEventArgs) _
    Handles DataGridView1.CellEndEdit

    Dim msg As String = _
        String.Format("Finished Editing Cell at ({0}, {1})", _
        e.ColumnIndex, e.RowIndex)
    Me.Text = msg

End Sub

适用于

另请参阅