Link to home
Start Free TrialLog in
Avatar of aftab2003
aftab2003

asked on

F10 function key

Hi,

I have a VB prog with a menu.
I can assignt F5 to F12 shortcuts
to different menu item EXCEPT F10.

F10 is not shown in the shortcut
list of menu editor. How do I correct this.

I am using VB6 with service pack 5.

Thanks for your help
Avatar of bingie
bingie

It is not listed because F10 is a system windows key for activating the main toolbar, i.e. File, Edit, View...etc.

You can still trap the key, just not assign it this way.

In the Form Load event write the following:
Me.KeyPreview = True

In Form Key Down:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        if keycode= vbKeyF10 then
                msgbox "F10 is pressed"
        end if
    End Sub
Avatar of aftab2003

ASKER

Hi Sethi,

The code worked perfect. But at the same time it has activated "File" menu as mentioned by Bingie. Is there any way to avoid this ? like vbsendkey ?

Thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of Sethi
Sethi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial