How to create Access Key(short cut) for a textbox ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm using vs2005, .net 2 for a Windows application.
I have a lable next to a textbox on a form. I would like under-score
certain letter in the label text and user can use Alt+letter and the focus
would be at the corresponding textbox with a blinking text cursor. How can I
do that? Thank you.
 
Pucca said:
Hi, I'm using vs2005, .net 2 for a Windows application.
I have a lable next to a textbox on a form. I would like under-score
certain letter in the label text and user can use Alt+letter and the focus
would be at the corresponding textbox with a blinking text cursor. How can I
do that? Thank you.

Put an ampersand ('&') character in the Label's Text string just before
the character you want to use as the shortcut key.

Then ensure that the Label instance has its tab order immediately before
the control to which you want focus set when the shortcut key is used
(see the TabIndex property...the Label should have a TabIndex that is
numerically just before the TabIndex for the control that should receive
focus).

That should do it.

Pete
 
That worked great! Thank you.
--
Thanks.


Peter Duniho said:
Put an ampersand ('&') character in the Label's Text string just before
the character you want to use as the shortcut key.

Then ensure that the Label instance has its tab order immediately before
the control to which you want focus set when the shortcut key is used
(see the TabIndex property...the Label should have a TabIndex that is
numerically just before the TabIndex for the control that should receive
focus).

That should do it.

Pete
 
Back
Top