Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 12-Oct-17 6:17am

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900