Click to See Complete Forum and Search --> : Create TextBox (Code)
Maarten Versteeg
January 17th, 2000, 04:46 AM
Please Help,
I want to create a TextBox on a Form by creating it with Code.
(Not select it with a mouse and drag and drop it on the Form!)
In that Code I want to set all its properties. How can I do this?
Thanks
Lothar Haensler
January 17th, 2000, 06:09 AM
in VB 6
private Sub Command1_Click()
Dim tx as Control
set tx = me.Controls.Add("VB.TextBox", "test")
tx.Visible = true
End Sub
Maarten Versteeg
January 17th, 2000, 06:27 AM
Thanks,
Just what I needed!
Maarten
Starcraft
January 17th, 2000, 11:59 AM
why dont you have the textbox already on the form, but set the visiblility to false, and set the properties by text1.whatever.
AndyK
January 17th, 2000, 12:47 PM
How to make it work in VB5???
Crazy D
January 17th, 2000, 03:15 PM
Add a textbox on the form, and make it Index 0, and set visible to false.
In code,
Load TextBox1(1)
TextBox1(1).Left = 100
TextBox1(1).Top = 200
TextBox1(1).Visible = true
Crazy D :-)
"One ring rules them all"
AndyK
January 17th, 2000, 09:11 PM
I need to make it as by "code" something like addcontrol thingy, so I was wondering if I could add control in vb some similar way, thanks tho for replying
Crazy D @ Work
January 18th, 2000, 02:12 AM
The only other way I can think of is use CreateWindow API but that's a bit of a pain.. Load .... is the closest you can get in VB5.
Crazy D @ Work :-)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.