By "F Keys" do you mean the Function keys? If so you cannot detect those in the KeyPress event. You can use the following code to demonstrate this to yourself:
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
MsgBox KeyAscii
End Sub
You CAN capture the Function keys, navigation keys, etc. using the KeyDown and KeyUp events.
VB comes with a set of predefined constants for the function keys - vbKeyF1 can be used to detect this key:
Code:
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
MsgBox "The F1 key was pressed"
End If
End Sub
EDIT: I forgot to add - you can get the various keycode constants from the Object Browser in the VB IDE. Right-mouse in the code window and select KeyCode Constants in the Class pane.
|
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
|