Click to See Complete Forum and Search --> : I don't know how to call it
QWERTY
Jan 10th, 2000, 02:51 AM
Ok here is the problem. I have a label on my form and I want to create a new one with exactly the same properties with code. I know that it is simple but I have very hard time doing it. Thanks for any help.
Regards QWERTY
Dayo312
Jan 10th, 2000, 03:24 AM
uh,
Sounds WAY to easy.
Just Make an Array of the control object that you want and that should have the same code.
Whats wrong with that idea??
KENNNY
Jan 10th, 2000, 06:44 AM
here's how:
Static NewIdx as integer
Sub LoadLabel
NewIdx = NewIdx + 1
Load Label1(NewIdx)
end sub
make sure the first Label1's Index property is set to 0 at design time.
so when u create a new Label1, it increases NewIdx, and loads a new label with the same properties.
------------------
cintel rules :p
www.cintelsoftware.co.uk
MartinLiss
Jan 10th, 2000, 08:50 AM
Controls created via the Load command are invisible when created, so you'll need to set their Visible property to true. You'll also need to move them some place since they will be drawn on top of the original control.
------------------
Marty
Clunietp
Jan 10th, 2000, 11:21 AM
In case anyone cares, you can add a control at run time without a control array:
Dim ctl As Label
Set ctl = Form1.Controls.Add("VB.Label", "lblNewLabel", Form1)
With ctl
.Visible = True
.Top = 200
.Left = 10
.Caption = "Hello World!"
End With
QWERTY
Jan 10th, 2000, 11:22 AM
Thanks!!!!
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.