RowIndex Property
Collapse the table of content
Expand the table of content

DataGridViewCellMouseEventArgs.RowIndex Property

 

Gets the zero-based row index of the cell.

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

public int RowIndex { get; }

Property Value

Type: System.Int32

An integer specifying the row index.

The following code example illustrates the use of this type.

// Override OnMouseClick in a class derived from DataGridViewCell to 
// enter edit mode when the user clicks the cell. 
protected override void OnMouseClick(DataGridViewCellMouseEventArgs e)
{
    if (base.DataGridView != null)
    {
        Point point1 = base.DataGridView.CurrentCellAddress;
        if (point1.X == e.ColumnIndex &&
            point1.Y == e.RowIndex &&
            e.Button == MouseButtons.Left &&
            base.DataGridView.EditMode !=
            DataGridViewEditMode.EditProgrammatically)
        {
            base.DataGridView.BeginEdit(true);
        }
    }
}

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft