|
Prev: Mouse wheel
Next: DAO and Win XP
From: Jack on 21 Feb 2005 17:22 Hello, I need to add the redimensioned number of text boxes to the form. I tried: Dim txt() As TextBox and then at Form_Load I tried to do: ReDim txt(20) For i = 0 To 19 Set txt(i) = New TextBox End If but vbasic will not let me do that. What is a proper way? Your thoughts are appreciated, Jack
From: Randy Birch on 21 Feb 2005 17:28 place one text box on the form (eg text1). Set its Index property to 0 to create a control array. Now use: cnt = cnt +1 load text1(cnt) text1(cnt).move <add new position for textbox> text1(cnt).visible = true To remove the added controls use the Unload command. You can't unload the original text box added at design time (text1(0)). -- Randy Birch MS MVP Visual Basic http://vbnet.mvps.org/ "Jack" <replytonewsgroup(a)please> wrote in message news:OEqqGPGGFHA.4004(a)tk2msftngp13.phx.gbl... : Hello, : I need to add the redimensioned number of text boxes to the : form. : I tried: : Dim txt() As TextBox : and then at Form_Load I tried to do: : ReDim txt(20) : For i = 0 To 19 : Set txt(i) = New TextBox : End If : but vbasic will not let me do that. : What is a proper way? : Your thoughts are appreciated, : Jack : :
From: Ken Halter on 21 Feb 2005 17:31 "Jack" <replytonewsgroup(a)please> wrote in message news:OEqqGPGGFHA.4004(a)tk2msftngp13.phx.gbl... > Hello, > I need to add the redimensioned number of text boxes to the > form. > I tried: > Dim txt() As TextBox > and then at Form_Load I tried to do: > ReDim txt(20) > For i = 0 To 19 > Set txt(i) = New TextBox > End If > but vbasic will not let me do that. > What is a proper way? > Your thoughts are appreciated, > Jack If your textboxes are part of a control array, use Load to load more... here's a "quicky" sample. Add Controls at Runtime http://www.vbsight.com/Code.htm -- Ken Halter - MS-MVP-VB - http://www.vbsight.com Please keep all discussions in the groups..
From: J French on 22 Feb 2005 02:45 On Mon, 21 Feb 2005 17:22:08 -0500, "Jack" <replytonewsgroup(a)please> wrote: >Hello, > I need to add the redimensioned number of text boxes to the >form. >I tried: >Dim txt() As TextBox >and then at Form_Load I tried to do: >ReDim txt(20) >For i = 0 To 19 > Set txt(i) = New TextBox >End If > but vbasic will not let me do that. >What is a proper way? The normal (and easiest way) is to put one Textbox on the Form - set its Index Property to 0 - then in code Load Text1( 1 ) Load Text1( 2 )
|
Pages: 1 Prev: Mouse wheel Next: DAO and Win XP |