禁用默认的输入/返回一个DataGridView键行为 [英] disable the default Enter/Return key behavior in a datagridview

查看:173
本文介绍了禁用默认的输入/返回一个DataGridView键行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vb.net datagridview的默认输入/返回键的行为是移动到下一行有一个快速简便的方法来避免这一点。

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

<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.processdatagridviewkey.aspx">DataGridView.ProcessDataGridViewKey方法

这篇关于禁用默认的输入/返回一个DataGridView键行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆