Koeneok
06-13-2002, 05:31 AM
Hello,
I want to add buttons (labels with actions) in runtime to my form. I use the following code, but it doesn't work well:
------
Private textboxs As New Collection
Private Sub Form_Load()
Dim lbl As Label
For i = 1 To 3
Set lbl = Controls.Add("vb.label", "naam" & i)
With lbl
.AutoSize = True
.Top = (i * 200)
.Caption = "see something"
.Visible = True
End With
textboxs.Add lbl
Next
End Sub
:( Private Sub textboxs_click(index As Integer)
MsgBox ("it works!!!")
End Sub
----------
I don't get the messagebox, but I want to make something like this.
Please help me.
I want to add buttons (labels with actions) in runtime to my form. I use the following code, but it doesn't work well:
------
Private textboxs As New Collection
Private Sub Form_Load()
Dim lbl As Label
For i = 1 To 3
Set lbl = Controls.Add("vb.label", "naam" & i)
With lbl
.AutoSize = True
.Top = (i * 200)
.Caption = "see something"
.Visible = True
End With
textboxs.Add lbl
Next
End Sub
:( Private Sub textboxs_click(index As Integer)
MsgBox ("it works!!!")
End Sub
----------
I don't get the messagebox, but I want to make something like this.
Please help me.