|
-
Aug 28th, 2000, 03:00 PM
#1
Thread Starter
Lively Member
how do you create a new instance of a control that is already on a form.
I have a control on a form and need to make a few of them but don't know how many i will need to until form is built.
thanks
VB 6 Professional Edition
-
Aug 28th, 2000, 03:05 PM
#2
Monday Morning Lunatic
Give the first control (already on the form) an index of 0, which will tell VB to use it as a control array. Then, just use the Load command to make a new one:
Code:
Load Text1(1)
Text1(1).Visible = True
Although the new control will be in exactly the same place as the original, so you'd need to move it using code.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 28th, 2000, 03:41 PM
#3
Don't forget to move it once you create it.
Code:
Load Picture1(1)
Picture1(1).Move 0, 0
Picture1(1).Visible = True
-
Aug 28th, 2000, 03:43 PM
#4
_______
'load an array of controls at runtime
'add 3 controls and line them up
'as above create the array and leave only one
'control on the form index(0)
[code]
Private Sub Command1_Click(Index As Integer)
Dim intcre As Integer
Do Until intcre = 3
intcre = intcre + 1
Load Command1(intcre)
Command1(intcre).Left = Command1(intcre - 1).Left + Command1(intcre).Width
Command1(intcre).Top = Command1(intcre - 1).Top
Command1(intcre).Visible = True
Loop
End Sub
[/code}
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|