我使用了CellEndEdit
事件,在编辑单元格值后按 Enter 键,然后单元格焦点向下移动。
我希望焦点回到我编辑值的原始单元格。
我用了很多方法,但都失败了。
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
当编辑后或输入键后,我不知道真正的代码,焦点又回到了被编辑的原始单元格中。
因为每次我按 ENTER 键时,它都会直接进入下一个单元格。
将焦点重新定位回已编辑的原始单元格的代码是什么。
我知道这种EditingControlShowing
方法,但我认为我也不必使用那种方法来获得我想要的东西。