CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Pressing a key

  1. #1
    Join Date
    Sep 1999
    Posts
    24

    Pressing a key

    If a user presses F5 a want my program to run a function.... How do I do that??


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Pressing a key

    set the KeyPreview property of your form to true,
    then:

    private Sub Form_KeyUp(KeyCode as Integer, Shift as Integer)
    If KeyCode = vbKeyF5 then
    MsgBox "F5!"
    End If

    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
  •  





Click Here to Expand Forum to Full Width

Featured