Results 1 to 7 of 7

Thread: [RESOLVED] Vb.net 2008 Simple movement help!

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Resolved [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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Vb.net 2008 Simple movement help!

    Welcome to the forums.

    What have you tried that isn't working and it driving you nuts?

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    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

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    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

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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
  •  



Click Here to Expand Forum to Full Width