0

My vb.net code is working perfectly, when I scan the barcode it interpret perfectly, but I must press enter to execute

Private Sub txtScan_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles txtScan.KeyDown

i.e. I must press enter to insert into datagridview. I want the code to insert to data into datagridview automatically after scanning into textbox.

Kindly help

  • 3
    You can normally configure the scanner to set whether it sends an 'enter' after a scan. Check the scanner settings as that's how we handle this. – Jon Roberts Aug 17 '22 at 09:02
  • You should be able to work out if it is a manually typed or scanned number by timing the duration between the first key press and the last (I’m assuming a fixed length barcode). When you reach the last, and if the last is below a time threshold then trigger an enter. – Steve Todd Aug 17 '22 at 09:04
  • You can apply the ideas in this article. [How do I distinguish between a scanner input and keyboard input in Javascript?](https://stackoverflow.com/q/53573584/9014308) – kunif Aug 17 '22 at 13:35

0 Answers0