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

Thread: Function Keys

  1. #1
    Join Date
    Aug 2001
    Location
    India
    Posts
    173

    Function Keys

    Hello gurus,
    I have a MDI form, which contains lot of child forms. For example, in one form, I would like to make use of function keys, F2-Save, F3-Open that way. In different forms, different keys are used. I do not anything abt this.

    Any help is greately appreciated.

    Regards,
    Shivakumar G.M.


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Function Keys

    You can use the KeyDown event of the child forms. Then you can use the KeyCOde to check what key was pressed.

    private Sub Form_KeyDown(KeyCode as Integer, Shift as Integer)

    Select Case KeyCode
    Case vbKeyF2
    MsgBox "You pressed F2"
    Case vbKeyF3
    MsgBox "You pressed F3"
    Case vbKeyF4
    MsgBox "You pressed F4"
    End Select

    End Sub




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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