|
-
Dec 21st, 2001, 11:27 AM
#1
Thread Starter
Junior Member
Trap function keys
How do you trap the function keys (such as:F1, F2,....) on the keypress event? Or know when that key is pressed?
Or is there an ascii code for these function keys?
Plz reply, it's urgent
thanks.
-
Dec 21st, 2001, 12:18 PM
#2
You don't use the KeyPress event for Function keys. Use either the KeyUp or KeyDown event. Example:
VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
MsgBox "You hit F1"
End If
End Sub
Make sure the Form's KeyPreview property is set to True (by default, it is False)
-
Dec 21st, 2001, 01:42 PM
#3
Yes, you are correct, the function keys are vbKeyF1 through vbKeyF12.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|