& or underscore in Vb.net

Cmr

Member
Joined
May 16, 2006
Messages
17
Programming Experience
1-3
In Visual basic 6.0 to use shortcut keys on the control we use the & symbol
eg. you have a command named Add. By writing it as &Add a line appears beneath A and by clicking Alt+A the event fires.

I tried the same in VB.net in the text property of the command control I wrote &Add. In design time there appeared a line beneath A, but during runtime it is not visible only the text appears as Add. The line made a disappearing act.

Where did I go wrong
 
You did not go wrong at all, the line(s) on the button(s) will appear once you hit the Alt key.

more info: "This behavior has nothing to do with .Net and is expected Windows behavior beginning with Win2000. Windows will only show accelerator keys after the alt is pressed. There is a control panel setting that you can use to change this behavior. Look for the Effects button on one of the tabs under Control Panel|Display to see a checkbox labeled "Hide keyboard navigation indicators until I use the Alt key".
 
Last edited:
Back
Top