When I use EditMode = EditOnEnter, The cell enter on editmode when I select the row.
It is hard to user to select the RowSelector to Delete the row.
do you know any Trick ?
When I use EditMode = EditOnEnter, The cell enter on editmode when I select the row.
It is hard to user to select the RowSelector to Delete the row.
do you know any Trick ?
You should understand that your program can't really read user's thought and understand when enter edit mode but when don't this.
User can press Escape key to cancel edit mode, then row can be deleted. Also you may choose other DataGridViewEditMode (see http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridvieweditmode.aspx ), for instance DataGridViewEditMode.EditOnKeystroke, or EditOnKeystrokeOrF2 that both are good from the usability point of view.
I Try this Trick:
When Cell Click:
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