Control hotkey on inherited form

J

Jack Jackson

VB2005. I built a class inherited from Windows.Forms.Form and placed
a Button on the form. The button.Text contains "&Quit".

I create another class that inherits from the first class. In the IDE
designer I see the button and its caption is Quit with the Q
underlined, as I expect.

When I run the second class, the button displays with a caption of
Quit with no underline. However the hotkey does work - Alt-Q does
cause the button to click.

Why is the caption not shown with the underline?
 
A

AlexS

Depends on version of Windows you run and settings. Press Alt and see if
underscore appears
 
J

Jeff Johnson

VB2005. I built a class inherited from Windows.Forms.Form and placed
a Button on the form. The button.Text contains "&Quit".

I create another class that inherits from the first class. In the IDE
designer I see the button and its caption is Quit with the Q
underlined, as I expect.

When I run the second class, the button displays with a caption of
Quit with no underline. However the hotkey does work - Alt-Q does
cause the button to click.

Why is the caption not shown with the underline?

When you run the second class on YOUR machine? Or someone else's? Have you
by any chance looked to see if ANY other application running on that machine
happens to display the accelerators by default? If not, then this is a
system-wide setting that you can control via the Display applet.
 
J

Jack Jackson

Thanks, that was it. This is a new machine that I just started using
a couple of days ago. I was not aware there was such a setting in
Windows, apparently all of the previous machines I have used had the
option set to always show the underscore.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top