Results 1 to 5 of 5

Thread: Keypress event [Resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    73

    Keypress event [Resolved]

    I want to use the keypress event on a form so that when the user presses the right or left arrow my cmdNext and cmdPrevious buttons will execute accordingly. If I use the form's keypress event it won't work cause the focus goes into the various textboxes or buttons on the form. How do I do it?
    Last edited by Jimmy80; Apr 15th, 2003 at 09:44 AM.

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    If you set the Form's KeyPreview property to true, the form receives the key events before the controls do.

    I think you need to use the KeyDown event though, because the keypress event cannot trap the arrow keys.
    Frans

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    73
    Thanks Frans, it worked as you said, with the keydown event.

  4. #4
    Lively Member
    Join Date
    Aug 2001
    Location
    Canada
    Posts
    86

    Exit Sub in TextBox

    How can you tell if the person is typing in a textbox? B/c if they are I dont want the Keypress todo anything, i want to let them continue to type. Understand what I'm asking?

  5. #5
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Exit Sub in TextBox

    Originally posted by Adamas
    Understand what I'm asking?
    Actually I am not sure I do! When the user types the keypress event of the object is fired. But what do you mean by saying

    I dont want the Keypress todo anything, i want to let them continue to type


    Has someone helped you? Then you can Rate their helpful post.

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