Results 1 to 5 of 5

Thread: simple keypress question?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    93

    simple keypress question?

    How can i make the arrow keys "click" a command button? example, left arrow key is next, right arrow key is back?

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: simple keypress question?

    on the keypress use somethinglike this

    cmdNext_click
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  3. #3
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Re: simple keypress question?

    You'll have to research to get the exact syntax, but
    In the KeyDown event of the Form, you'll get a KeyCode passed to you. You can then test something like this:
    vb Code:
    1. Select Case KeyCode
    2.     Case vbKeyLeft
    3.         Call cmdBack_Click
    4.     Case vbKeyRight
    5.         Call cmdNext_Click
    6.     ' etc.
    7. End Select
    "It's cold gin time again ..."

    Check out my website here.

  4. #4
    Member Shadow503's Avatar
    Join Date
    Apr 2006
    Posts
    37

    Re: simple keypress question?

    Call cmdNext_click

    Edit:The above response is much better, use that one.

  5. #5
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: simple keypress question?

    Just be sure that there's no text box or any other object stealing the focus. Bear in mind, a command button CAN be selected without being clicked, so if CmdBack has focus, a test in Form_KeyPress won't trigger anything.

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