当按下十进制键时,跳至下一个文本框 [英] when decimal key is pressed tab to next textbox
本文介绍了当按下十进制键时,跳至下一个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个IP地址输入文本框,就像他们在Windows中创建的那样.
当用户按十进制键(.)时,应按Tab键并转到下一个
文本框.
我该如何使用Visual C#来做到这一点?
在此先感谢:)
I am trying to create a IP address input text box just like the one they have it with the windows.
when a user presses decimal key (.) it should tab and go to the next
textbox.
who do i go about doing this using Visual C#
Thanks in advance :)
推荐答案
处理按键按下事件.
每次.按下,通过代码跳至下一个.
可以使用SendKeys
方法完成.
Handle the key down event.
Every time a . is pressed, tab to the next through code.
This can be done using theSendKeys
method.
1)已经完成,仅按TAB键,不按点即可.如果您导致用户碰到点,他们会讨厌的.这不是最佳选择.参见下文,以获得更好的结果.
2)IP地址太容易使用四个文本框播放.使用System.Windows.Forms.MaskedTextBox
看起来像是专门设计来编辑IP地址的!
—SA
1) This is already done, only press TAB, not dot. If you cause the users to hit dot, they''ll hate it. This is not the best option. See below to a better one.
2) IP address is too easy to play with four text boxes. UseSystem.Windows.Forms.MaskedTextBox
which looks like it was specially designed to edit IP addresses!
—SA
这篇关于当按下十进制键时,跳至下一个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文