Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Give a Control Focus via Hotkey 1

Status
Not open for further replies.

mikemcginty

Programmer
Jul 11, 2002
184
AU
I want to give a control object focus by using a hotkey on its associated label object

For example I assign the lbl.caption as "&Set Control Focus"
When I press ALT S, I want Control.setfocus to action

What label event will fire when ALT S is pressed?

I tried the click event but it doesn't fire

Thanks

Mike

When you call out for help in the darkness, and you hear a voice in return, you're probably just talking to yourself again!
 
If the caption is on a label, then the GotFocus event of the control with the next TabIndex value (that has a the ability to get the focus) will fire
 
Try this

If SendKeys = "{ALT}+{S}" Then
'*****Your Code Goes Here*****
Else
'*****Extra Code for Else*****
End If

Dan
 
Dan, did you actually test that before posting? Did you read the question?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thanks All

Just to clarify the solution from strongm

I assigned the label with the previous Tab Index to the object I want it associated. Because the label can't receive focus, the next index ( ie the object) will receive focus

I gave a star to strongm to show his (her?) solution was spot-on and appreciated

Mike

When you call out for help in the darkness, and you hear a voice in return, you're probably just talking to yourself again!
 
'His', definitely 'his'. Or my wife will have words to say.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top