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

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.
 
P

Peter Duniho

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
 
G

Guest

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
 

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