Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I  associate as specific label shortcut with a specific textbox?

Posted on 2004-09-21
5
Medium Priority
?
271 Views
Last Modified: 2008-02-26
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?
0
Comment
Question by:sperodev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12117697
write this in your KeyDown Event

 If (e.Alt And e.KeyValue = "a") TextBox1.Focus();
 If (e.Alt And e.KeyValue = "b") TextBox2.Focus();
0
 

Author Comment

by:sperodev
ID: 12117912
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.?
0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12117984
this function seemed only supported by menu

if you want it you have to write some code;
0
 

Author Comment

by:sperodev
ID: 12118196
C'mon experts, you can do it!
0
 
LVL 5

Accepted Solution

by:
tzxie2000 earned 570 total points
ID: 12118398
set label1.tabindex=1
set textbox1.tabindex=2
set label1.tabindex=3
set textbox1.tabindex=4
you can get it

the most important is not the number assigned to tabindex

the msdn said that when you Press alt-a(suggest in l&abel),the focus will set to the controls tabindex next to the label
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question