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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autmatically moving focus between controls

Status
Not open for further replies.

STPMB

Programmer
Sep 13, 2002
28
US
Is the best way to move thefocus automatically between controls by setting up a control array and incrementing the index after each control has had it's data validated?
 
You could also use the SendKeys "{TAB}" or SendKeys "+{TAB}" in the validate event. You will need to have the TabIndex of each control set in the order that you want.

And then you could create a method, calling it from the Validation event, that gets passed the active control's name and do a SELECT CASE:

Sub MoveFocus(ActiveControlName as String)
Select CAse ActiveControlName
Case "Text1"
Text2.SetFocus
End Select

End Sub
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top