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!

Upgrading Control Arrays

Status
Not open for further replies.

RobertMottram

Programmer
Apr 25, 2002
39
0
0
GB
I have just moved from VB 6 to VB.NET and finding a number of things have changed. I know that most of the VB 6 functions can be called using the compatability functions, but as I write new code I think it would be better to use the new methods.
The problem I am have is finding a way around not having Control Arrays. I want to be able to added controls to my form in the program. When this form loads I added a number of these controls (all the same), but I don't know how many until this point in the code.
One of these is a text box, so in VB 6 I placed a hidden text box on the form and made it part of an array. This means in my code I can added to the array with arraytextbox.load to add new ones. Then just un hide them.
How can I do this in VB.NET. I don't want to add the controls to the form until run time as I never know how many I will need.
Also I want them all to run the same functions.

Thanks

Robert
 
So what you are wanting to do is dynamically add controls to your page from the page load event, correct?

Here is an article on dynamically adding controls, it may be of use to you eventhough it is in ASP .NET the functionality will help you apply it to your VB app

Hope this helps.

Regards,
NatGreen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top