简体   繁体   中英

When scanning from barcode, it fires the event associated with enter key

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.

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM