DataGridViewCellMouseEventArgs.RowIndex Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the zero-based row index of the cell.
public:
property int RowIndex { int get(); };
public int RowIndex { get; }
member this.RowIndex : int
Public ReadOnly Property RowIndex As Integer
Property Value
An integer specifying the row index.
Examples
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);
}
}
}
' Override OnMouseClick in a class derived from DataGridViewCell to
' enter edit mode when the user clicks the cell.
Protected Overrides Sub OnMouseClick( _
ByVal e As DataGridViewCellMouseEventArgs)
If MyBase.DataGridView IsNot Nothing Then
Dim point1 As Point = MyBase.DataGridView.CurrentCellAddress
If point1.X = e.ColumnIndex And _
point1.Y = e.RowIndex And _
e.Button = MouseButtons.Left And _
Not MyBase.DataGridView.EditMode = _
DataGridViewEditMode.EditProgrammatically Then
MyBase.DataGridView.BeginEdit(True)
End If
End If
End Sub
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET