Last active
December 10, 2015 18:29
-
-
Save ryasmi/4475357 to your computer and use it in GitHub Desktop.
Handling multiple key presses in Visual Basic. Useful for controls in games and shortcut keys. Based on my YouTube tutorial (http://www.youtube.com/watch?v=G6ZbQ1kpAtQ&list=PL63C2673281C99172&index=4).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Tutorial @ http://www.youtube.com/watch?v=G6ZbQ1kpAtQ&list=PL63C2673281C99172&index=4 | |
Private Sub _KeyDown(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown | |
If e.KeyValue = Keys.W Then | |
Label1.Text = "W Pressed" | |
End If | |
If e.KeyValue = Keys.S Then | |
Label2.Text = "S Pressed" | |
End If | |
End Sub | |
Private Sub _KeyUp(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp | |
If e.KeyValue = Keys.W Then | |
Label1.Text = "W Not Pressed" | |
End If | |
If e.KeyValue = Keys.S Then | |
Label2.Text = "S Not Pressed" | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment