Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am building a MVC application - i wanted to know how do I connect a handheld barcode scanner (like the one in the shops) to scan an item and populate a text box with the barcode?


What I have tried:

Nothing seems to be working - solutions are mostly given when people are using windows forms apps or twain or something related. i am really confused and need the help asap. any help would be appreciated
Posted
Updated 25-Sep-20 11:15am
Comments
ZurdoDev 25-Sep-20 16:36pm    
Barcode scanners are really easy. They will automatically scan into any textbox. You don't even need to write code.

Most scanners are shipped configured to act as if they were keyboards and will generate keystrokes for the Article Number you scan as if you have types it on a regular KB.

That's where the good news stops: you can't tell is the data came form a KB or the scanner, so unless the input focus is always in an input box you will not get the code to read or know where it starts and ends.
You can get round this by configuring the scanner to provide "lead in" and "tail out" sequences, but you will need to talk to teh manufacturers to find out how to do that as it varies from model to model.
 
Share this answer
 
Most barcode scanners are what's called a "keyboard wedge". Whatever they scan gets "typed" exactly as if it were a keyboard. So, whatever textbox has the input focus at the time the scanner is used gets whatever the scanner "types".
 
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