Click here to Skip to main content
13,706,367 members
Rate this:
Please Sign up or sign in to vote.
See more:
if i had a form in 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 6:10am
Updated 12-Oct-17 6:17am

1 solution

Rate this: bad
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.

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 | Cookies | Terms of Service
Web06-2016 | 2.8.180920.1 | Last Updated 12 Oct 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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