View Single Post
Join Date: Oct 2006
Posts: 169
Reputation: ptaylor965 is an unknown quantity at this point 
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Programming keyboard keys in vb.net

 
0
  #2
Nov 30th, 2008
In the forms properties set KeyPreview to True and then use the Key subs that the form supplies
  1. Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
  2.  
  3. End Sub
AND/OR
  1. Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
  2.  
  3. End Sub
You can check which key was pressed using
  1. If e.KeyCode = Keys.Left Then
  2.  
  3. End If
To handle the Left key press
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote