I used the CellEndEdit
event, after editing the cell value I press the Enter Key, then the cell focus moves down.
I want the focus to go back at the original Cell where I edited the value.
I used many ways, but failed.
Private Sub DataGridVie1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridVie1.CellEndEdit
'...
'....editing codes here...to input and validate values...
'...
'...
'...before the End If of the procedure I put this values
DataGridVie1.Rows(e.RowIndex).Cells(e.ColumnIndex).Selected = True
DataGridVie1.CurrentCell = DataGridVie1.Rows(e.RowIndex).Cells(e.ColumnIndex)
'DataGridVie1.BeginEdit(False) '''DID NOT apply this because it cause to edit again.
End If
I don't know the real code when after edit or after a ENTER KEY the focus is back in the original Cell that was edited.
Because everytime I HIT the ENTER KEY, it directly go down to the next Cell.
Whats the code to reposition the focus back to the original Cell edited.
I know the EditingControlShowing
method but I don't think I have to used that method to get what I wanted too.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…