Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    On Key Press (2000)

    I have form that has two text boxes and an OK button. When the user enters their data, they are supposed to select OK. I have the OK button coded and it works. How can I set up the OnKeyPress event for the text box so pressing enter is the same as pressing OK.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: On Key Press (2000)

    If you make the OK button the default button, it should work anyhow when they click enter. That doesn't require a key event on the textbox.
    Charlotte

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: On Key Press (2000)

    To elaborate on Charlotte's reply: a command button has a Default property (in the Other tab of the Properties window). If you set it to Yes, pressing Enter will act as if you clicked the command button. Similarly, if you set the Cancel property of the command button, you can "click" the button by pressing the Escape key.

Posting Permissions

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