在 vb.net datagridview 中,默认的 Enter/Return 键行为是移动到下一行,是否有一种快速简便的方法可以避免这种情况。
欢迎任何建议
最佳答案
您可以在 gridview key down 事件中尝试这样的操作
Private Sub DataGridView1_Keydown (...) Handlers DataGridView1.KeyDown
If e.KeyCode = Keys.Enter Then
' Your code here
e.SuppressKeyPress = True
End If
End Sub
另一种选择是创建自定义网格 View 控件
DataGridView.ProcessDataGridViewKey Method
关于.net - 禁用 datagridview 中的默认 Enter/Return 键行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1887299/