For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Controls > January 2006 > Pressing F10 Without Activating Form Menu









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Pressing F10 Without Activating Form Menu
Bob

2006-01-24, 7:07 pm

In my Form_KeyDown event, I have coding so pressing F10 does some stuff.
But it also activates the form menu, which I do no not want to happen.

Is there a workaround so this does not happen?

Thanks, Bob


Ken Halter

2006-01-24, 7:07 pm

"Bob" <bpan@softchoice.com> wrote in message
news:OOJwtuSIGHA.1192@TK2MSFTNGP11.phx.gbl...
> In my Form_KeyDown event, I have coding so pressing F10 does some stuff.
> But it also activates the form menu, which I do no not want to happen.
>
> Is there a workaround so this does not happen?
>
> Thanks, Bob


The only real work-around is to not use F1, F10 or any other key that's
assigned by Windows itself. Anything else will require a ton of code and may
cause grief with other running applications.

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Freeware 4 color Gradient Frame? http://www.vbsight.com/GradFrameCTL.htm


Bob

2006-01-24, 7:07 pm

I found the solution at http://www.codecomments.com/message484228.html.

Basically set Shift = 0 and KeyCode = 0. For example:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF10
... Do some stuff ...
Shift = 0
KeyCode = 0
End Select
End Sub




"Bob" <bpan@softchoice.com> wrote in message
news:OOJwtuSIGHA.1192@TK2MSFTNGP11.phx.gbl...
> In my Form_KeyDown event, I have coding so pressing F10 does some stuff.
> But it also activates the form menu, which I do no not want to happen.
>
> Is there a workaround so this does not happen?
>
> Thanks, Bob
>



MikeD

2006-01-24, 9:58 pm


"Bob" <bpan@softchoice.com> wrote in message
news:%23F3AXGTIGHA.3144@TK2MSFTNGP11.phx.gbl...
> I found the solution at http://www.codecomments.com/message484228.html.
>
> Basically set Shift = 0 and KeyCode = 0. For example:
>
> Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
> Select Case KeyCode
> Case vbKeyF10
> ... Do some stuff ...
> Shift = 0
> KeyCode = 0
> End Select
> End Sub



That's really not good. F10 is basically a function key reserved by
Windows. You shouldn't use F10 at all. Altering the standard functionality
of any key (particularly F keys) is not a good thing. Windows has standards
for a reason. Apps that override those standards are usually quite difficult
to work in. This is precisely why VB's Menu Editor does not include F10 in
the dropdown for Shortcut.

My advice: Use a different function key.

--
Mike
Microsoft MVP Visual Basic


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com