I have made a program for recording the progress of products as they move throughout the factory. Each department scans the the card with the job number on it. I have used a lostfocus event to trigger the code to run. And the scanner has a tab for the suffix. The problem is that when someone moves the focus for any other reason it causes an error and shuts the program down. Is there a better way to handle barcode scanning? Or how can I resolve this issue.
Are your scanners sending the data as keyboard input?
well… the best way i have found to do this is to program the scanner to send a prefixChar on the scan, probably a STX chr(02), but anything the user can’t produce on a keyboard. put a handler on the form so it catches keyboard input and if you see the prefix, you know its from the scanner and you can process it accordingly
of course, when you replace a scanner you need to remember to program it, which causes issues