Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form keyDown not working?

Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    If e.Control Then
        MessageBox.Show("aaaa")
    End If
End Sub

As you can see, my form will check for when the control key is pressed down. But it doesn't work. Why?

like image 736
Voldemort Avatar asked Apr 03 '11 20:04

Voldemort


1 Answers

I am not near a computer now so I can't test this, but when I have wanted to get key events on a form before, I would set Form1.KeyPreview to True (or something similar).

like image 56
wageoghe Avatar answered Oct 02 '22 12:10

wageoghe