|
-
May 1st, 2009, 12:17 AM
#1
Thread Starter
New Member
[RESOLVED] Vb.net 2008 Simple movement help!
All I want to do is move a button i have on the form by pressing the left arrow key, and I can not find the right way to do this......please help as it is driving me insane!
Thnaks,
Matt
-
May 1st, 2009, 06:38 AM
#2
Re: Vb.net 2008 Simple movement help!
Welcome to the forums. 
What have you tried that isn't working and it driving you nuts?
-
May 1st, 2009, 07:04 AM
#3
Re: Vb.net 2008 Simple movement help!
Hey,
Can you confirm exactly what you are trying to do?
It would sound like what you want to do is the following:
1) Handle the keypress event of the form
2) If the key being pressed is the left arrow key decrease the Left Property of the Button
3) If the key being pressed is the right arrow key change increase the Left Property of the Button.
Gary
-
May 1st, 2009, 10:30 AM
#4
Thread Starter
New Member
Re: Vb.net 2008 Simple movement help!
To be honest I am just learning vb.net(obviously). All I want to do is make a button move to the left when left arrow key is pressed, and to the right when right arrow key is pressed. In vb6 it was something like:
if keypress = vbleft then
button.left = button.left + 10
end if
That's all I really want to do and I just cant figure it out. I know it's a very noob question and I appreciate the help!
Thanks,
Matt
-
May 1st, 2009, 11:02 AM
#5
Re: Vb.net 2008 Simple movement help!
Hey,
What you have there would appear to be valid, you just need to get it into .Net.
Have a look at using the KeyPress Event for the form:
http://msdn.microsoft.com/en-us/libr....keypress.aspx
In this event you can check the KeyCode that is passed in and check against the KeyCode Enumeration for the button you are interested in.
Gary
-
May 1st, 2009, 12:17 PM
#6
Thread Starter
New Member
Re: Vb.net 2008 Simple movement help!
Thank you very much! I have figured it out! Now on to more learning! Seriously thanks again!
Matt
-
May 2nd, 2009, 03:25 AM
#7
Re: [RESOLVED] Vb.net 2008 Simple movement help!
Hey,
Not a problem at all, glad you got it sorted out!!
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|