Keyboard shortcuts do not respond to vb.net2010

This does not work in my application. It is funny that this also does not give an error.

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 saw where people use this in the video, and it worked for them. I do not know why mine is not working.

+3
source share
1 answer

You need to set the KeyPreviewform property to true.

Walter

+3
source

All Articles