需要帮助重新构建gridview [英] Need help reagrding gridview

查看:88
本文介绍了需要帮助重新构建gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



i有一个数据网格,我想要点击任何单元格并按回车键,然后控件应转到下一个单元格。

默认情况下会进入下一行。

当我按Tab键时它会进入下一行。



所以我想要输入键中的标签功能



请告诉我怎么做..



谢谢你

Hi all

i have one datagrid and i want like when i click on any cell and press enter key, then the control should go to the next cell.
by default it is going to the next row.
and when i press tab it''s going to the next cell.

So i want that tab function in enter key

Please tell me how to do..

Thank you

推荐答案

你的问题很混乱,但我想你希望你的gridview在按下之后将光标/焦点移动到下一个单元格输入键而不是去下一行(换句话说,做标签键)。



如果是这样,那么对我来说最简单这样做的方法是在KeyDown事件中捕获密钥并发送需要按下的密钥



Your question is quite confusing but I assume you want your gridview to move the cursor/focus to the next cell after pressing the "enter" key instead of going to the next row (in other words, do what the "tab" key).

If that is the case then for me the easiest way to do that is to trap the key in KeyDown event and send the key that you need to be pressed

Private Sub DataGridView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown     
      If e.KeyCode = Keys.Enter Then
          e.SuppressKeyPress = True
          SendKeys.Send("{TAB}")
      End If
End Sub





可能会干扰你需要做的其他事情,但可以相应调整。



This might interfere with other things you need to do but can be adjusted accordingly.


这篇关于需要帮助重新构建gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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