Click here to Skip to main content
15,936,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create an accounting program with c# language.

I want to use a barcode gun for scanning barcode (pod) from courier covers .

Now, in main form if user uses a barcode reader(barcode gun) to get barcode value,

How can I get barcode value in background of Form (with text box).

what methods or events are used in it.?

Note: My barcode reader is HID (USB interface)
[no name] 25-Sep-13 8:11am    
adriancs 27-Sep-13 0:39am    
Just press the trigger on the Barcode Gun and fire the laser. The barcode gun will return a line of text that it read from the bar code. There is no special configuration for the barcode gun to work. It is standardize. It works just like a keyboard input. You can assume that the gun is a keyboard. Unless you are using old type of barcode gun, then you will need the manufacturer driver/API/Plugin Library/etc. By the way, the device is normally called Barcode Scanner in English.

A barcode scanner/reader attached to your client machine acts like another kind of input as it is a keyboard. So, if focus is on the TextBox when the user scan the barcode using the gun, the decoded value will automatically displayed on the textbox. Of course, depending on the barcode symbology, sometimes value is not clear at all. I mean, if you scan a UPC or EAN barcode, then simple number digits will be displayed but if you scan a QR Code or Datamatrix containing raw bytes, then some strange chars might be displayed. Anyway, you should capture the Text_Changed event or lost focus of your TextBox, get the Text value and process it accord.
Share this answer
When I've done this, I usually set the barcode reader (they are usually programmable) to supply a carriage return after a successful scan. Then I simply treat it as if the user entered text and pressed ENTER.

So, treat the barcode scanner exactly like the keyboard.
Share this answer
I think you need an API of the device's manufacturer.
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