|
-
Jan 10th, 2000, 03:51 AM
#1
Thread Starter
Fanatic Member
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
-
Jan 10th, 2000, 04:24 AM
#2
Addicted Member
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??
-
Jan 10th, 2000, 07:44 AM
#3
Hyperactive Member
here's how:
Code:
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 
www.cintelsoftware.co.uk
-
Jan 10th, 2000, 09:50 AM
#4
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
-
Jan 10th, 2000, 12:21 PM
#5
Guru
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
-
Jan 10th, 2000, 12:22 PM
#6
Thread Starter
Fanatic Member
Thanks!!!!
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|