Control array

I have to create an control array (lets say..of textboxes). I don't  know at design time how many (but I know the max).
How do I create a new control when I need it. The set ... =new ...  doesn't work. It only works for creating new forms but not other controls.
AzmodanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jetforceCommented:
Just load the textbox just as follows

Load Text1(2)
Text1(2).Left = 100
Text1(2).Visible = True

remember to make sure that you have at least 1 textbox and make sure the index is set to 0
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jetforceCommented:
Ps.  Just change the 2 for the right number, make sure you you dont use the same number again unless you unload the textbox. You dont have to go in increments you could load 3 then 5 and 2 etc.

You can see what indexs have been used by the following code

Dim i As Control

For Each i In Me.Controls
  If i.Name = "Text1" Then
    MsgBox i.Name & "(" & i.Index & ")"
  End If
Next

Hope this helps
0
AzmodanAuthor Commented:
thankx
it works
0
modderCommented:
Upgraded to "A" as requested in http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20156118

modder
Community Support
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.