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
Printable View
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
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??
here's how:
make sure the first Label1's Index property is set to 0 at design time.Code:Static NewIdx as integer
Sub LoadLabel
NewIdx = NewIdx + 1
Load Label1(NewIdx)
end sub
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
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
In case anyone cares, you can add a control at run time without a control array:
Code: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
Thanks!!!!
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.