How can I scan a barcode and put it into a textbox?
I know that a barcode reader works as a standard keyboard.
I have a barcode scanner. I have created 5 barcodes (representing the text "box_1", "box_2", ..., "box_5").
When I scan a barcode and put it into notepad it works, i.e. if I scan the barcode "box_1" it puts the text "box_1" into notepad, and so on for the other barcodes.
But when I scan into a textbox it does not work.
If I scan the barcode "box_1" it puts "box_1" into the textbox, but if I scan "box_5" it still puts "box_1" into the textbox. Whichever barcode I scan, the textbox gets "box_1".
The barcode scanner will put the value in whatever TextBox has focus. Typically a barcode scanner will end the Enter
key after the value of the barcode. You could use this to advance to the next TextBox
Is there something different about each barcode that identifies which TextBox the value should be in? If that is the case, I would recommend having one TextBox which serves as the entry TextBox. Once entry is complete (you can tell this by looking for the Enter
), inspect the value and move it to the correct TextBox.