禁用datagridview中的默认Enter / Return键行为 [英] disable the default Enter/Return key behavior in a datagridview
本文介绍了禁用datagridview中的默认Enter / Return键行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在vb.net datagridview中,默认的Enter / Return键的行为是移动到下一行是否有一个快捷方便的方式来避免这种情况。
In vb.net datagridview the default Enter/Return key behavior is to move to the next row is there a quick and easy way to avoid that.
任何建议欢迎
推荐答案
您可以在gridview键下拉事件中尝试这样的事情
You can try something like this in the gridview key down event
Private Sub DataGridView1_Keydown (...) Handlers DataGridView1.KeyDown
If e.KeyCode = Keys.Enter Then
' Your code here
e.SuppressKeyPress = True
End If
End Sub
另一个选项是创建自定义网格视图控件
Another option would be to create a custom grid view control
DataGridView.ProcessDataGridViewKey方法
这篇关于禁用datagridview中的默认Enter / Return键行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文