DataGridView.Editmode = EditOnEnter. How to Select the row to Delete it?
I Try this Trick:
If the user clicks on a row header, change the EditMode to EditOnKeystrokeOrF2
and end the edit.
If the user clicks somewhere else, change the EditMode to EditOnEnter
and begin the edit.
Private Sub dgv2_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv2.CellClick
If e.ColumnIndex = -1 Then
dgv2.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2
dgv2.EndEdit()
ElseIf dgv2.EditMode <> DataGridViewEditMode.EditOnEnter Then
dgv2.EditMode = DataGridViewEditMode.EditOnEnter
dgv2.BeginEdit(False)
End If
End Sub