I have a C# WinForm application. On my Buttons I use the '&' (in the .Text properties) for
Hotkey access. The strange behavior is that
the '&' is converted to the appropriate underscore while
in design mode BUT DOES NOT appear at Runtime.

At runtime the Hotkey functionality works, but the
relevant underscores do not appear. For example, I have a
buttonSearch.Text = "&Search". At Runtime, the button
displays as "Search" and pressing "alt + S" triggers the event.

but the problem is that the underscore3 is not shown before i press alt !!!

Is this a bug? Or is there an obvious solution I have
overlooked. I do have KeyPreview = true.

Any suggestions would be greatly appreciated!
Thanks,

That's the default behavior of windows; it had nothing to to with your code/application. The underscores will only appear after you hit the alt key.

This expains how you can change it for windows 7 http://twigstechtips.blogspot.com/2009/08/windows-7-restore-menu-underline.html And i'm sure you can change it on other versions as well.

But if you run it on another pc, you'll have the same problem. So it's best not to worry about it, it really can't be helped

no its not that settings !! since on other normal buttons it works !! it doesn't work only on ribbon controls !! bdw thanks for yr reply !! what is another way of doing short cut keys?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.