Can anyone help please?
How can I give focus to a textbox (for example we have two) by defining a shortcut key as alt+m ?
Thanks in advance
Btw, I'm a beginner so please tell me in the simplest way. :)

Use a Label in front of each text box and in the Caption for the Label, use an & in front of the letter to define the shortcut key - &m in your example. Make sure the Label's TabIndex is one less than the TabIndex for its associated TexBox. That should do it.

Well this doesn't work out. :(
Can anyone please help me out? I have an exam coming. :(

While, I would suggest using a menu with a key combination shortcut, the suggestion by SCBWV does work...

Start a new standard exe project and add in this order, text box (text1), label (label1), text box (text2). Now set the caption of the label to &Focus. You should see Focus in the labels caption. Now, just to make sure that the tab orders are correct, lets check.

Text1 TabIndex = 0
Label1 TabIndex = 1
Text2 TabIndex = 2

Run the program and press ALT+F. You should see the carat jump from text1 to text2.

Good Luck

Thank you so much dear. It worked out perfectly. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.