Results 1 to 2 of 2

Thread: F12

  1. #1
    Join Date
    Oct 2003
    Location
    London
    Posts
    341

    Unanswered: F12

    Hi guys,

    Can anyone help me with a code?

    I want to run an event on a specific key press.. Say F12 because I don't think thats used, but I don't know what to write for this, how can I let the pc know that F12 is the trigger for an action?

  2. #2
    Join Date
    Jul 2004
    Posts
    69
    Hi! Let's say you want to show a new form named Form2 when F12 is pressed.

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF12 Then Form2.Show
    End Sub

    Be sure to set the KeyPreview property of your form to True.

    vbKeyF12 is a VB key constant. You can also use the numeric value of it, in this case 123; works the same.

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 123 Then Form2.Show
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •