1

I am developing a POS application where the barcode scanner reads the barcode and displays the barcode text. It is working fine but as i have used the enter key for submitting the form, which i have triggered with overriding ProcessCmdKey().

So after everytime i do a scanning from barcode scanner, it triggers my custom function of save. how do i prevent barcode from emulating the ENTER keypress.

3 Answers3

1

For Honeywell scanner follow the steps.

Take a print out of This document and scan the code you want. It has options for enable and disable CR and LF.

Ref: Reference Link

Shahzeb Khan
  • 3,582
  • 8
  • 45
  • 79
  • 1
    This is a good point. Most of the scanners I've used so far have special control barcodes or other ways of configuring the device. You should always read the documentation of the scanner you use. – Felix B. Mar 12 '19 at 08:23
0

I don't think you can do that, and if this is something possible it will depends on the POC scanner itself. So it might be different from one manufacturer to the other.

What you can do however is to handle Enter event on bar code text box, this way that event handler will get called instead of save event.

AJ -
  • 621
  • 5
  • 9
0

It is not inevitable that an "Enter" is pressed by a barcode scan. Either the barcodes you are scanning include an enter character, or your software is reacting to the scan event, or your scanning device is set to add a "CR" after every barcode it scans.

  1. To diagnose, open up a text editor and scan some barcodes into it. If each barcode advances the cursor to the next line, there's nothing wrong with the event handler. Either you've got "CR" embedded in your barcodes or your scanner is messed up.
  2. Scan other people's barcodes into the text editor. If no matter who's barcodes you scan, you advance to a new line you'll have to find out how to configure your scanner not to do that. Otherwise your barcodes have the "CR" embedded. Fix your barcode generator.
  3. If, on the other hand, when you scan your own barcodes into a text editor, they stack along eachother on the same line, it is the software that's firing the trigger.
Brian Anderson
  • 1,661
  • 1
  • 17
  • 27
  • I scanned other people's barcode as well and getting the same issue, so i don't think there is any issue with my barcode generator. It's the barcode scanner which is behaving like this and i have no clue on how to configure my barcode scanner not to do that. Is it possible to do it through coding? –  Oct 25 '17 at 12:49
  • Depends on the model of scanner. Are you sure you are using a text editor and not your app? Other people's barcodes may exhibit the same behavior in your app, and it may be the event handler. Make sure you are using the scanner in a text editor and not a word processor like Google Docs or Microsoft Word. – Brian Anderson Oct 25 '17 at 14:22
  • If your scanning device is adding the "CR" character, then it is stuck in data format mode. Some scanners allow you to add a prefix or suffix (or both) to each scan of a barcode. This should only be a valid operating mode if you are using the barcode scanner with one and only one application, because many applications behave differently. – Brian Anderson Oct 25 '17 at 14:38
  • You should be sure to check out https://stackoverflow.com/questions/3001543/reading-from-an-usb-barcode-scanner – Brian Anderson Oct 25 '17 at 14:42
  • thanks Brian for your help! i didn't want to go for such complications so i have changed my shorcut key to " Ctrl + Enter". –  Oct 26 '17 at 06:23
  • As long as your POS has a keyboard, that's probably acceptable. Good luck. – Brian Anderson Oct 26 '17 at 10:04