Search code examples
c#barcodescanning

How do I correctly capture data from a Symbol LS2208 barcode scanner with C#


I have been asked to develop a C# Winforms application that reads barcodes and processes data based on products with the relevant barcode.

The barcode scanner we're using is a Symbol LS2208 usb scanner and when it came there was no instructions or cd in the box. We plugged it in, it beeped at us and were were able to scan barcode values into notepad as a test.

In my application, how do I ensure that the scanner populates data into the relevant textbox (I've been setting focus after every other action such as button clicks etc) and how do I know when the entire barcode has been scanned? Currently I have a form timer that ticks every 50ms and checks the length of the textbox value. If it stops getting bigger, I assume the entire barcode has been written.

It just feels a bit "clunky" and wondered if there was another way to do this?


Solution

  • Distinguishing Barcode Scanners from the Keyboard in WinForms

    Check out this thread. There's everything you need there.

    If you'll be using this particular scanner, you can setup it to send a specific signal at the end of the input. To setup your scanner gun you need to read the documentation for your device, probably provided on the website of the manifacturer.

    Another solution if you will be using the same scanner gun.

    If your clients are going to use a lot of different scanners, it would be slight difficult to set everyone of them and track their input. In such case, you have to do it with counting the time between the keypresses (Windows cannot distinguish between barcode scanner and normal keyboard). But you still have to know the suffix of the input the scanner sends.