如何防止条形码扫描器在所有文本框中读取并且只在文本框中读取与条形码单元格相关 [英] How I can prevent barcode scanner from reading in all textboxes and read only in the textbox relates to barcode cell

查看:122
本文介绍了如何防止条形码扫描器在所有文本框中读取并且只在文本框中读取与条形码单元格相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在vb.net中有一个表单,它包含一些文本框,如txt_item_id和txt_item_barcode,我怎么能阻止条形码扫描器读取txt_item_id并只读取txt_item_barcode



我尝试了什么:



仍在搜索有关解决方案的网站

if i had a form in vb.net and it contain some textboxes like txt_item_id and txt_item_barcode how i can prevent the barcode scanner from reading in the txt_item_id and read only in txt_item_barcode

What I have tried:

still search through websites about the solution

推荐答案

除非您将条形码扫描器配置为提供特定的引入和引出字符或序列,否则不能这样做。



Most条形码扫描仪出货设置为键盘:当您扫描条形码时,其中的数据(通常只是一个文章编号,但不一定是)作为击键发送 - 你无法分辨它们来自Windows的来源不保留记录;所有击键只是一系列按键和按键代码,它处理并生成相应的消息,它绕着应用程序的窗口路由。



因此,无法判断代码是来自真正的键盘还是来自扫描仪,因此您无法限制它的位置。



但是大多数扫描仪都可以配置为导入/导出代码,允许您将焦点设置为适当的控制 - 但是具体如何配置它取决于制造商。查看特定单元的手册,或查看制造商网站:大多数都习惯了这个并且非常有帮助。
You can't, unless you configure your barcode scanner to provide specific "lead in" and "lead out" characters or sequences.

Most barcode scanners ship set to act as a keyboard: when you scan a barcode the data inside it (normally just an article number, but it doesn't have to be) is sent as keystrokes - and you cannot tell where they originated as Windows does not keep a record of that; all keystrokes are just a sequences of "key down" and "key up" code with it processes and generates the appropriate messages for, which it routes round your application's windows.

As a result, there is no way to tell if a code came from the "real" keyboard or from a scanner, so you can't restrict where it goes.

But most scanners can be configured for lead in / out codes which allows you to set the focus to the appropriate control - but exactly how you configure it is up to the manufacture. Look in the manual for your specific unit, or check the manufacturer website: most are used to this and pretty helpful.


这篇关于如何防止条形码扫描器在所有文本框中读取并且只在文本框中读取与条形码单元格相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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