sperodev
asked on
How do I associate as specific label shortcut with a specific textbox?
Let's say I add 2 labels, L&abel1 and La&bel2, to a form. I then I add two textboxes,textBox1 and textBox2, to a form.
How do I get textBox1 to get the focus when I hit Alt-b, and textBox2 to get the focus when I hit Alt-a?
How do I get textBox1 to get the focus when I hit Alt-b, and textBox2 to get the focus when I hit Alt-a?
ASKER
I guess I need to repose the question.
While that may solve the problem, I still don't understand how, if you take first plop down a label on a new form, and then a textbox, and then change the labels caption to incorporate a shortcut, you get the label-textbox shortcut association "for free". I've looked through the code of a form that was made this way, and I can't see where the textbox and label are associated. How does C# accomplish this association, and can I do it in a similar fashion programatically.?
While that may solve the problem, I still don't understand how, if you take first plop down a label on a new form, and then a textbox, and then change the labels caption to incorporate a shortcut, you get the label-textbox shortcut association "for free". I've looked through the code of a form that was made this way, and I can't see where the textbox and label are associated. How does C# accomplish this association, and can I do it in a similar fashion programatically.?
this function seemed only supported by menu
if you want it you have to write some code;
if you want it you have to write some code;
ASKER
C'mon experts, you can do it!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If (e.Alt And e.KeyValue = "a") TextBox1.Focus();
If (e.Alt And e.KeyValue = "b") TextBox2.Focus();