I am trying to create keypress handler that will execute a line of code when Tab, Space, or Enter key is pressed or passed by the scanner gun while the control is in focus. I got it to work with space and enter key but with tab key, the cursor will just jump to the next tab stop without executing the code.
Anyone know how to make tab key work?
Private Sub Button2_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles Button2.KeyPress
Dim keyChar As Char
keyChar = e.KeyChar
If AscW(keyChar) = 9 Or AscW(keyChar) = 32 Or keyChar = "\t" Or keyChar = "\r" Then
Button2.PerformClick()
Else
e.Handled = True
End If
End Sub
Thanks in advance