Click to See Complete Forum and Search --> : New control in the code


isabelle
January 21st, 2000, 02:03 PM
How can I create a new control (like a TextBox)
in the code???
Is it possible???
Help me please...

Isabelle

Aaron Young
January 21st, 2000, 02:23 PM
If you have VB6, you can add control directly to the Controls Collection, eg.

private Sub Command1_Click()
Controls.Add "VB.Textbox", "Text1"
me!Text1.Move 0, 0
me!Text1.Text = Text1
me!Text1.Visible = true
End Sub



Otherwise, you could create a Control Array of Invisible Textboxes at DesignTime, (Create1 and Set the Index to Zero), then load the Textboxes as you need them, eg.

private Sub Command1_Click()
Load Text1(1)
Text1(1).Move 0, 0
Text1(1).Caption = Text1
Text1(1).Visible = true
End Sub





Aaron Young
Analyst Programmer
ajyoung@pressenter.com
aarony@redwingsoftware.com

isabelle
January 24th, 2000, 08:27 AM
And for a Control Array???