Creating things at runtine

Jeff_B
07-02-2004, 02:51 PM
Is it possible to create text/combo boxes at runtime? For example, the user types in a number and (eg 3) and then that number of combo boxes appear for the user to input further info? Or would I have to create a default number before design time and simply hide them until/if they are needed.

Any examples would be great.
Thanks, Jeff

Draders
07-04-2004, 05:30 AM
you can.

in your main form declarations dim whatever control you want in an array or all seperate whichever you prefer.


Dim textboxs() As textbox


then do something similar to this code in whatever situation you want to create them


ReDim textboxs(3)
Dim i As Integer
For i = 0 To 3
textboxs(i) = New TextBox
textboxs(i).Top = 10
textboxs(i).Left = 10 + i * 30
textboxs(i).Width = 20
Me.Controls.Add(textboxs(i))
Next

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum