How to use Funtion Keys in my project

I want my application to end on pressing F1 key,
user to logout on pressing F2 etc
How do I do it ?

Comments

  • I am not sure of doing this. But one simple idea is u can use the ASCII key values of the functional keys and then you can manipulate the action which u want to do. Cheers...



  • : I am not sure of doing this. But one simple idea is u can use the
    : ASCII key values of the functional keys and then you can manipulate
    : the action which u want to do. Cheers...
    :

    Hai, Here you have to add a KeyUp Event for your Form. Now compare the KeyCode with a constant in vbKeyCodeConstants.

    Example

    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF1 Then
    MsgBox "F1 pressed"
    End If
    End Sub

    Example End

    Use object browser for more vbKeyCodeConstants.
  • Thanks it worked.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories