嗨,我有 4 列的 datagridview,前三列是 texbox,第四列是命令按钮。我想覆盖 datagridview 中的 enter 键,以便它将焦点设置到下一列而不是下一行?当我到达 texbox 第 3 列时,它会跳过命令按钮并移至下一行这是我的代码
Class MyDataGridView
Inherits DataGridView
Protected Overloads Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean
If keyData = Keys.Enter Then
MyBase.ProcessTabKey(Keys.Tab)
Return True
End If
Return MyBase.ProcessDialogKey(keyData)
End Function
Protected Overloads Overrides Function ProcessDataGridViewKey(ByVal e As KeyEventArgs) As Boolean
If e.KeyCode = Keys.Enter Then
MyBase.ProcessTabKey(Keys.Tab)
Return True
End If
Return MyBase.ProcessDataGridViewKey(e)
End Function
End Class
这段代码工作正常,但唯一的问题是它也是我想跳过命令按钮的焦点命令按钮。bcz 命令按钮是删除记录按钮