Results 1 to 5 of 5

Thread: How do you capture function keys on a vb form?

  1. #1
    Guest
    Thanks!

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    You may not like the answer. Every place you want that function key active, you must put a trap in the keydown or keyup event to capture the function key press. If there are a lot of controls, this can be a real pain. Have fun!

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    HDR, I don't agree...

    Use this
    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If Shift = 1 And KeyCode = vbKeyJ Then MsgBox "SHIFT"
    End Sub
    
    Private Sub Form_Load()
    Me.KeyPreview = True
    End Sub
    this will work for all control... and what do you mean with Function keys? F1...F12 ?
    that you could do

    If KeyCode = vbKeyF1 ....

    GoodLuck!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    I check out this board almost every morning hoping to learn something new. Thanks Jop.

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Yeah, keep coming over, you learn new stuff every day!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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