Reputation: 79
This does not work on my application. Funny thing is, it does not give off an error either.
Private Sub frmMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.A Then
MsgBox("A pressed")
End If
End Sub
I have seen where people use this in videos and it worked for them. I do not know why mine does not work.
Upvotes: 3
Views: 51
Reputation: 7204
You have to set the KeyPreview
property of the form to true.
valter
Upvotes: 3