Results 1 to 11 of 11

Thread: [RESOLVED] keypress for function keys??? help??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2007
    Posts
    19

    Resolved [RESOLVED] keypress for function keys??? help??

    ei guys,

    i need ur help... what are the keypress (vb ascii code) for function keys?? tnx

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: keypress for function keys??? help??

    vbKeyF1 through vbKeyF12
    VB Code:
    1. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    2. 'Set the Form's KeyPreview property to True
    3. Select Case KeyCode
    4. Case Is = vbKeyF1
    5. MsgBox "You pressed F1"
    6. Case Is = vbKeyF2
    7. MsgBox "You pressed F2"
    8. Case Is = vbKeyF3
    9. MsgBox "You pressed F3"
    10. Case Is = vbKeyF4
    11. MsgBox "You pressed F4"
    12. Case Is = vbKeyF5
    13. MsgBox "You pressed F5"
    14. Case Is = vbKeyF6
    15. MsgBox "You pressed F6"
    16. Case Is = vbKeyF7
    17. MsgBox "You pressed F7"
    18. Case Is = vbKeyF8
    19. MsgBox "You pressed F8"
    20. Case Is = vbKeyF9
    21. MsgBox "You pressed F9"
    22. Case Is = vbKeyF10
    23. MsgBox "You pressed F10"
    24. Case Is = vbKeyF11
    25. MsgBox "You pressed F11"
    26. Case Is = vbKeyF12
    27. MsgBox "You pressed F12"
    28. End Select
    29. End Sub

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,427

    Re: keypress for function keys??? help??

    There are no (Ascii codes) for the Function keys. Do a search on detecting Function Key presses - there are a few examples posted here

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2007
    Posts
    19

    Re: keypress for function keys??? help??

    this is for vb6 ryt? tnx so much...

  5. #5
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,427

    Re: keypress for function keys??? help??

    There you go, KeyCode constants for Function Keys.........

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: keypress for function keys??? help??

    ryt?

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Feb 2007
    Posts
    19

    Re: keypress for function keys??? help??

    VB Code:
    1. ei hack, i mean d keys that u gave, i was asking if its for vb6? thanks so much [/CODE]

  8. #8
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,427

    Re: keypress for function keys??? help??

    It is vb6, but not ASCII.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: keypress for function keys??? help??

    Quote Originally Posted by bang_01
    VB Code:
    1. ei hack, i mean d keys that u gave, i was asking if its for vb6? thanks so much [/CODE]
    This is the Classic VB forum section, so any code examples I post here is for VB6.

  10. #10
    Registered User
    Join Date
    Sep 2019
    Posts
    3

    Re: keypress for function keys??? help??

    Good morning...
    I need help..
    I tried my codes but nothing happen when i press "F8"

    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case Is = vbKeyF8
    'Text2.Text = Text1.Text + 1
    MsgBox "it is F8"
    End Select
    End Sub

  11. #11
    Member
    Join Date
    Sep 2016
    Location
    Texas panhandle
    Posts
    55

    Re: [RESOLVED] keypress for function keys??? help??

    Code:
    Private Sub Form_Load()
     Me.KeyPreview = True
    End Sub

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