简体   繁体   中英

Keydown event vb.net fails to respond?

I have the following code snipet which I have in my vb.net program but it dosnt work??? it has absolutly no response, perhaps someoneout there knows why?

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    If (e.KeyCode = Keys.Q AndAlso e.Modifiers = Keys.Control) Then
        MsgBox("CTRL + Q Pressed !")
    End If
End Sub

I'm using VB.net

Set KeyPreview property of the form to true. The form will then get to know about key events even when a control has focus.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM