Alt + 'Chr' Short cut key problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sachinkale123
    New Member
    • Jul 2007
    • 37

    Alt + 'Chr' Short cut key problem

    I m working on windows application. Here in this i am giving '&' for short cut key. In design time I can see 'under score ' under that perticular character but in run time i am not able to see that ..so please tell me what is the exact problem.
  • cloud255
    Recognized Expert Contributor
    • Jun 2008
    • 427

    #2
    Do you want the user to press alt+"&", this i dont think is possible unless you use some code to check for the key combination.

    If you want Visual Studio to generate the code for you, you need to add the "&" in front of the text of a control eg: &Command1 will make the alt+C call the control.

    When you run the application, by deafault you cannot see the underscore, as soon as you press the alt key the underscores will appear.

    the ShowKeyboardCue s contains a boolean stating if the underscore is visible or not, but this is read only...

    I tried the following in the load event of the form, but the form seems to ignore it

    Code:
    SendKeys.Send(Keys.Alt.ToString());
    So i'm not sure how to make the underscores visible as soon as the form loads, but i will keep looking into it...

    After consulting the MSDN i found that this actually comes from a windows setting which states that the shortcut keys should be hidden until the user presses alt. see this for more info.

    So you could go in and play with some environmental variables to force the system value to change, but i doubt that your users will appreciate this.

    Comment

    Working...