
Adding Controls at run time
Gary,
Put a textbox on your form and set it's index property to 0 and it's visible
property to false.
Put a second textbox on the form so the user can enter the number of
textboxes desired.
Next put a command button to confirm and create the number of textboxes
desired.
in the command buttons click event put the following code,
Dim numTextboxes, counter
numTextboxes = text2.text
for counter = 1 to numTextboxes
load text1(counter)
text1(counter).left = 100
text1(counter).top = counter * 300 ' 300 as long as the scalemode
property of the form is Twips
text1(counter).visible = true
next counter
Hope this helps, if your still unclear about this just look up "Control
Arrays" in VB help.
Regards,
Jonathan Roach - CEO Stormdev Software Development
Quote:
> I am creating a form where I would like the number of text boxes that
> appears depends on a number the user chooses.
> How can I create the text boxes as needed as opposed to putting all of
them
> on the form and making the unneeded ones invisible.
> I checked MSDN library and could not find anything.
> TIA
> Gary