按ENTER键在文本框之间传输 [英] press ENTER for transfer between to textboxes

查看:89
本文介绍了按ENTER键在文本框之间传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我有2个文本框,其中一个(textbox1)可以接受一些字符。当我在文本框1中输入字符时,按ENTER键,字符移动到另一个文本框(textbox2)。我该怎么办? textbox1的哪个事件?

hi i have 2 text boxes that one of them(textbox1) can accept some characters. when i enter characters to the text box1, by press "ENTER", characters move to another text box(textbox2). what shall i do? which event of textbox1?

推荐答案

简单的答案是:不要



正常ENTER的动作是接受数据并关闭,而不是复制表单周围的数据,并且颠覆这种行为是一个坏主意,因为它会混淆用户:他们期望与其他所有应用程序和你的行为不起作用 - 这可能导致用户不想使用你的应用程序,纯粹是因为其他应用程序不这样做。



找到另一个密钥,只需添加他们可以根据需要单击传输按钮 - 然后在将Form.KeyPreview属性设置为true后使用Form覆盖ProcessCmdKey方法。
The simple answer is: "Don't"

The "normal" action of ENTER is to accept data and close, not to copy data around a form, and subverting that behaviour is a bad idea as it confuses users: they expect a behaviour with all their other applications and yours "doesn't work" - this can result in users not wanting to use your app, purely because other apps "don't do it like that".

Find another key, and just add a "transfer" button they can click if they want - then use the Form to override the ProcessCmdKey method, after setting the Form.KeyPreview property to true.


press-enter-to-move-to-next-control [ ^ ]


感谢大家

thanks from all of you
if (e.KeyChar == (char)13)


这篇关于按ENTER键在文本框之间传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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