views:

30

answers:

2

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 ?

+1  A: 

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.

STO
I know all other modes. Users want Excel mode like. I use EditOnEnter only on Frequent used DGV. I know how to delete a row, but instruct each user on this behavior ....Esc Key can cancel edit, but on this mode re-Enter on Edit Mode. I do´nt understand why selecting the RowSelector, do´nt ends Edit mode. A solution is move cursor to a not editable cell.
x77
A: 

I Try this Trick:

When Cell Click:

  • if index = -1 EndEdit and EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2
  • Else If EditOnKeystrokeOrF2 - Restore EditMode and BeginEdit

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
x77