Hi all & thanks for looking.
I was able to pickup keyboard button presses in VB5/6 years ago & I am trying to do this new (years later) in VB 10 Express.
It is so frustrating, but I cannot seem to get it to work, while it was so easy to do back then.
All I am trying to do is listen for the keyboard "ESC" key & close out the application (form/window) when it has been pressed.
The code can't get simpler than this:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
Me.Close()
End If
End Sub
I was able to pickup keyboard button presses in VB5/6 years ago & I am trying to do this new (years later) in VB 10 Express.
It is so frustrating, but I cannot seem to get it to work, while it was so easy to do back then.
All I am trying to do is listen for the keyboard "ESC" key & close out the application (form/window) when it has been pressed.
The code can't get simpler than this:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
Me.Close()
End If
End Sub