Results 1 to 4 of 4

Thread: F1 to F12 Keys

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Location
    Philippines
    Posts
    218

    F1 to F12 Keys

    Hi guys,

    How will VB6 know that the user presses F1,F2..F12 keys?

    I could not find the Ascii values of these keys.

    I need to work with them in Form_KeyPress event.

    thank you guys.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: F1 to F12 Keys

    They do not have Ascii codes.. you need to use the KeyDown/KeyUp events instead, eg:
    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    
      If KeyCode = vbKeyF1 Then
        MsgBox "F1"
      End If
    
    End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Location
    Philippines
    Posts
    218

    Re: F1 to F12 Keys

    Wow !!

    Thank you very very much !!!!

    You helped me !!!!

    Quote Originally Posted by si_the_geek
    They do not have Ascii codes.. you need to use the KeyDown/KeyUp events instead, eg:
    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    
      If KeyCode = vbKeyF1 Then
        MsgBox "F1"
      End If
    
    End Sub

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

    Re: F1 to F12 Keys

    Don't forget to set the Form's KeyPreview property to True.

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