使用条形码扫描仪将值传递到第一个文本框后自动聚焦到下一个文本框 [英] Automatically focus to next textbox after enering value to first textbox by using barcode scanner
问题描述
在我的带有数据库访问权限的vb.bet应用程序中,我有一个表单,有6个文本框。要在文本框中输入数据,我正在使用条形码扫描仪。
因此,当我输入数据时,例如Textbox1,焦点应自动更改为下一个Textbox2,然后更改为第3个,依此类推,直到6个文本框。在第6个文本框之后,它应该显示msgThe Rack Is Full并且所有值都应该自动保存。
我怎样才能得到它。
我搜索了很多但无法获得线索。
我正在使用数据仓来保存数据。
此代码适用保存数据。
In my vb.bet application with database access , a form I have 6 Textbox. To enter data in the textbox I am using Barcode scanner.
So when I enter the data in e.g. Textbox1 ,the focus should be changed automatically to next Textbox2 and then to 3rd and so on untill 6 textboxes. After 6th Textbox it should display the msg "The Rack Is Full" and all value should be saved automatically.
How can I get this.
I searched a lot but not able to get the clue.
I am using databinder to save the data.
This code applies to save data.
Me.Validate()
Me.Samplebindingsource.EndEdit()
Me.TableAdapterManger.UpdateAll(Me.Sample_StorageDataSet)
我的尝试:
我没有发现任何线索。
我试图更换扫描仪。
What I have tried:
I didn't find any clue.
I tried to change the scanner.
推荐答案
你需要做的是:
- 在表单加载时给你的Textbox1成为焦点 - 覆盖OnFormLoad-Method或使用你自己的方法使用FormLoad-Event
- 如果是文本框中的文本1更改为Focus to Textbox2 - 使用Textbox1.TextChanged-Event和您自己的方法。在此方法中,您还可以检查输入是否有效,然后切换到Textbox2
- 如果Textbox2中的Text更改为Focus to Textbox3 - 使用Textbox2.TextChanged-Event和您自己的方法。在这种方法中,您还可以检查,如果输入有效,那么在切换到Textbox3
- 等等
- 在Textbox6_TextChanged方法中检查是否所有输入都是更正,然后保存该数据。
What you have to do is :
- give your Textbox1 the Focus when Form loads - override the OnFormLoad-Method or use the FormLoad-Event with your own method
- if the Text in Textbox1 is changed give the Focus to Textbox2 - use the Textbox1.TextChanged-Event with your own method. In this method you can also check, if the input is valid before you switch to Textbox2
- if the Text in Textbox2 is changed give the Focus to Textbox3 - use the Textbox2.TextChanged-Event with your own method. In this method you can also check, if the input is valid before you switch to Textbox3
- and so on
- in the Textbox6_TextChanged-method you check if all inputs are correct and then save that data.
这篇关于使用条形码扫描仪将值传递到第一个文本框后自动聚焦到下一个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!