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.
Printable View
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.
You don't use the KeyPress event for Function keys. Use either the KeyUp or KeyDown event. Example:Make sure the Form's KeyPreview property is set to True (by default, it is False)VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then MsgBox "You hit F1" End If End Sub
Yes, you are correct, the function keys are vbKeyF1 through vbKeyF12.