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

setfocus on textbox in control array

Status
Not open for further replies.

barbola

Technical User
Feb 27, 2003
1,132
0
0
CA
I have a control array of six textboxes and in another subroutine I would like to set the focus on the first textbox for user input.

textbox(0).setfocus is incorrect

Is there a simple way? You would think??

thanks.


 
Hi Barbola:

I tested the textbox SetFocus with an array of textboxes. There was no problem. Can you give the error message that occurs?


Cassie
PIII-500Mhz-128MB
Win98SE-VB6SP5
 
It just tells me that is not the correct way to use setfocus. It's on a diff computer, so I will check later.

I did find this, and will try it later:

Text1(Text1.LBound).SetFocus




 
Maybe the first textbox in the array is not Zero. Check the form to see if the Index is zero
 
Yes the first textbox index is zero, and

Text1(text1.lbound).setfocus worked perfectly.

thanks.


 
Aha. You were saying TextBox in the original post, and Text1 in the subsequent one. Perhaps therein lay your problem.

Bob
 
actually, no, i was just using whatever as an example. In my program it was another name LOL. I'll try to work on consistency in my posts from now on.


 
Are you getting an invalid procedure call or argument error? Do you have the code in the Form_load event? If so try moving it to the Form_activate event.

Shannan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top