Click here to Skip to main content
15,917,632 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,
I am trying to call a function whenever a barcode value received from barcode reader with out focus on textbox.
what I mean is : i want to read barcode value without focus on specific textbox and when value been read i want to do cal a function that fill data on textboxes according to the text of the barcode.

What I have tried:

i did not try anything yet, waiting for suggestion
Posted
Updated 22-Feb-18 1:22am
Comments
Richard MacCutchan 22-Feb-18 6:57am    
What exactly is the difficulty with this? Assuming you receive some sort of notification when the barcode has been read, you just call the function at that point.
Member 13199484 22-Feb-18 7:07am    
okay, how to receive a notification when the barcode has been read?
i need to save the barcode value in variable once i scan the device but with out focusing on Textbox, I just want to open custom page and scan the item, i need to catch the read process to call a function
Richard MacCutchan 22-Feb-18 7:14am    
That all depends on how the barcode reader works.
Member 13199484 22-Feb-18 7:18am    
maybe i missed explain myself.
how to set a trigger if barcode reader was used.
i know there are such triggers to track a keyboard keys, how to set it for barcode?

1 solution

Unless you change the configuration, most scanners arrive set up to emulate a keyboard, and work by feeding data in exactly as if the user had typed it - which means it goes into whatever control has the input focus.

To direct it to a particular textbox means that you need to change the scanner to provide lead in / lead out codes, which your software can recognise and set the focus appropriately.

But ... how you do that depends on the manufacturer (and sometimes the specific model) of the scanner. So start with the documentation, then the manufacturer website, and find out how to add lead in / lead out codes that you can work with.
 
Share this answer
 
Comments
Member 13199484 22-Feb-18 7:27am    
i thing i cannot control the reader.
thank you
OriginalGriff 22-Feb-18 7:30am    
Check: if necessary ask the manufacturer.
Otherwise, you can't do what you want - there is no way to look at a keystroke as say "this came from the scanner" or "this came from the actual keyboard".
Member 13199484 22-Feb-18 7:33am    
you are right, but i can do a trick, i will add a hidden textbox to the window,
on the startup function i will set the focus on this textbox and i will set a TextChange event for this text box that check the entered value if the length is 15 character(the SN length) call another function.
what you thing about it?
OriginalGriff 22-Feb-18 7:42am    
You do realize that not all barcodes are 15 digits, right? Not even all consumer units use 15 - there are UPC-A (12), UPC-E (6), EAN-13 (13), EAN-8 (8), Code39 (not even just digits), Code128 (can be huge), ...

Trust me, configuring the barcode scanner is a much, much safer way to go!
Member 13199484 22-Feb-18 8:36am    
You are 100% right.
I said 15 because the value I receive when scanning is 15 numbers, i have static format

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