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

Adding a control Array to the Form.Controls Collection ?

Status
Not open for further replies.

NicPev

Programmer
Jul 19, 2000
1
0
0
GB
Does anyone know how to add a control Array of text boxes or labels to the Form.Controls Collection. I need this so I can generate an entry form from a script held in a database. <br>Nick<br><br>
 
if you are in design mode then just create a textbox and go on pasting it (after copying the text box) on the form . for the first time VB will ask you to create a control array or not. if u want to do it through code  then just create a textbox and set its index property to 1. Now the following code should work<br><br>Dim x as textbox<br><br>x= New textbox<br><br>this will create a new textbox.<br><br>hope this helps<br><br>Nikhil
 
Also not that you MUST have a control of the type you need an array of on the form AT DESIGN TIME, and it MUST already have an index (control arrays are usually indexed from 0 in VB).<br><br>Also, not that controls added at run time inherit most of the properties of the &quot;original&quot; control, this means that they will - by default be placed directly on top of the &quot;orignial&quot;, so - to use them, you MUST to reposition them on the form.<br><br>Michael<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top