Click here to Skip to main content
13,287,116 members (44,561 online)
Rate this:
 
Please Sign up or sign in to 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 12-Oct-17 7:10am
Updated 12-Oct-17 7:17am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.171207.1 | Last Updated 12 Oct 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100