I have the keypreview to be true. Now whenever I press a key the form_keypress event is firing twice and giving me multiple values. I used a scanner , still getting multiple keys.
Any idea whats wrong?
Printable View
I have the keypreview to be true. Now whenever I press a key the form_keypress event is firing twice and giving me multiple values. I used a scanner , still getting multiple keys.
Any idea whats wrong?
when you stop through your code.. is the keypress event being called for the second time before the first run through the event finishes?
yes.As soon as it finishes the first time it goes into keypress event one more time.
can you post the code?
Here is the code:
Private Sub Form_KeyPress(KeyAscii As Integer)
strcmd = strcmd & Chr(KeyAscii)
'If this is a cmd and not a barcode, skip the class.
If Len(strcmd) = 5 And Right(strcmd, 1) = "|" Then
'There is a pipe in the 5th character. Is this too short to be a barcode
If Mid(strcmd, 1, 2) = "11" Then
'this is a cmd
CmdProcessor (Mid(strcmd, 1, Len(strcmd) - 1))
End If
strcmd = ""
Exit Sub
End If
End Sub