User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 403,299 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,801 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums

Making keystrokes move a picture box?

Join Date: Nov 2007
Location: ★ Jogja ★
Posts: 2,477
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Rep Power: 9
Solved Threads: 215
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Nearly a Posting Maven

Re: Making keystrokes move a picture box?

  #3  
May 10th, 2008
handle it with keyDown Event.
this following code is form keydown event, you can do same with other controls.
  1. Private Sub Search_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
  2. If e.KeyCode = Keys.Up Then
  3. 'PictureBox1.Top -= 10
  4. MsgBox("Key Up Pressed")
  5. ElseIf e.KeyCode = Keys.Down Then
  6. 'PictureBox1.Top += 10
  7. MsgBox("Key Top Pressed")
  8. ElseIf e.KeyCode = Keys.Left Then
  9. 'PictureBox1.Left -= 10
  10. MsgBox("Key Left Pressed")
  11. ElseIf e.KeyCode = Keys.Right Then
  12. 'PictureBox1.Left += 10
  13. MsgBox("Key Right Pressed")
  14. End If
  15. End Sub
Last edited by Jx_Man : May 10th, 2008 at 1:36 am.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
All times are GMT -4. The time now is 7:04 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC