hey all. I have a barcode scanner connected to a PC that working with a c# program.now i want to distinguish between the scanner and the keyboard which one is sending data to my program. can everyone help me with a code or advise in c#?
somebody said this to me in another topic(but i can't do this yet): basically you can configure the scanner to send some characters that basically tell the computer "hi, it's me". When you see those characters in your input stream, you know the information is coming from the barcode scanner, not from something the user typed on the keyboard. Did you check the manual that came with your barcode scanner? It should have more information about this.
The scan data will typically end with a carriage return or line feed character, called the suffix. You may be able to configure the scanner to include a prefix as well. That is what your friend was trying to tell you.
See update, as at March 2019: https://stackoverflow.com/a/55411255/495455
If your application works with particular barcodes (eg all same char length or ones that can be matched with a RegEx) then you could possibly work it out by coding up a Robot Typing test. eg:
VB.Net:
C#: