Wednesday, 19 October 2016
VB ARROW KEY MOVEMENT
---------------------------------------------------------------------------------------------------------
CODE:
0) COPY AND PASTE BELOW CODE IN FORM.vb
1) FROM THE TOOL BOX DRAG AND DROP PictureBox1
NOTE:
https://www.google.co.uk/search?q=VB+ARROW+KEY+MOVEMENT
Detecting arrow keys in winforms C# and vb.net
Most Windows Forms applications process keyboard input exclusively by
handling the keyboard events.
You can detect most physical key presses by
handling the KeyDown or KeyUp events.
Key events occur in the following order:
KeyDown KeyPress KeyUp---------------------------------------------------------------------------------------------------------
Public Class Form1
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.Left
Me.PictureBox1.Left
-= 1
Case Keys.Up
Me.PictureBox1.Top
-= 1
Case Keys.Right
Me.PictureBox1.Left
+= 1
Case Keys.Down
Me.PictureBox1.Top
+= 1
End Select
End Sub
End Class
---------------------------------------------------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment