dcsimg
Results 1 to 4 of 4

Thread: Pressing enter clicks button-probably very simple

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2009
    Location
    Bulgaria
    Posts
    18

    Pressing enter clicks button-probably very simple

    Hi

    I want to be able to hit enter or return on the keyboard and then for the next button to automatically click. Once you're done typing in the value to a textbox you hit return and the next button clicks.

    It's probably a very simple line of code but I can't figure it out!

    Thanks in advance,

    Dave

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,576

    Re: Pressing enter clicks button-probably very simple

    It is one of the form properties. I believe it is the AcceptButton property, or one named something like that. You indicate which button is used for Accept. You can also indicate which button to use for Cancel.
    My usual boring signature: Nothing

  3. #3
    Junior Member Dawg's Avatar
    Join Date
    Nov 2009
    Location
    Portland Or, USA
    Posts
    26

    Re: Pressing enter clicks button-probably very simple

    You could also use the _KeyPress and/or _KeyUp events for your textbox to check if the key pressed was the Enter key, and then call the _Click event for your "Next" button.

    I don't have VB in front of me so I can't post an example - but if you look up the two events I mentioned you should be able to figure it out.

  4. #4
    Addicted Member
    Join Date
    Oct 2009
    Posts
    212

    Re: Pressing enter clicks button-probably very simple

    the easiest way is to set the forms acceptbutton to the button you want to click when they hit enter. It can be done in the designer.
    Have you tried Google?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width