Hi,
I have this form that has all these controls on it such as buttons, entry fields, lists, and combo boxes, and I've been looking around the net for a while now trying to find a way to track key presses on my form so that I can trigger a set of code. For example when the user presses Shift + W call code that moves picture box up. I have the KeyPreview set to True on the form and I have placed this code.
I'm pretty new to the Visual Basic language and can't seem to work out what I've done wrong here. Any pointers or suggestions would be greatly appreciated.
Thanks, Karl
I have this form that has all these controls on it such as buttons, entry fields, lists, and combo boxes, and I've been looking around the net for a while now trying to find a way to track key presses on my form so that I can trigger a set of code. For example when the user presses Shift + W call code that moves picture box up. I have the KeyPreview set to True on the form and I have placed this code.
Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.Shift And e.KeyCode = Keys.W Then MovePictureUp() lblMessage.Text = "Moved" End If End Sub
Thanks, Karl
Comment