How to capture whole Barcode value on Winform without using TextChanged event?

后端 未结 3 459
广开言路
广开言路 2020-12-06 19:10

When a barcode is scanned on form1, I make a call to database to get the item for this barcode and open form2 with pre-populated data.

If I use text changed event t

3条回答
  •  被撕碎了的回忆
    2020-12-06 19:53

    This is a result of the scanner in WedgeMode. basically it acts as a keyboard and every character scanned creates a text changed event.

    There are many solves.

    You could use an api supplied by the company you bought the scanner off, instead of wedgemode

    However, a simple solve is to put a prefix and suffix (like the ascii codes, STX and ETX ) on the scanner (there are usually settings for this supplied by the scanner), that way you know when you have complete bar-code data.

    When you see a valid barcode, then you make one event, not an event for each character scanned.

提交回复
热议问题