Dim txt As TextBox
Dim leb As Label
Dim com As CommandButton
Private Sub Command1_Click()
Set txt = Controls.Add("VB.TextBox", "txt" & tn & "")
Set txt.Container = Form1
txt.Move 500, 1400 + tc, 1200, 350
txt.Visible = True
txt.Text = "TextBox" & tn & ""
tc = tc + 1000
tn = tn + 1
End Sub
Private Sub Command2_Click()
Set leb = Controls.Add("VB.Label", "leb" & ln & "")
Set leb.Container = Form1
leb.Move 3000, 1400 + lc, 1200, 350
leb.Visible = True
leb.Caption = "Label" & ln & ""
lc = lc + 1000
ln = ln + 1
End Sub
Private Sub Command3_Click()
Set com = Controls.Add("VB.CommandButton", "com" & cn & _
"")
Set com.Container = Form1
com.Move 6400, 1400 + cc, 1200, 350
com.Visible = True
com.Caption = "Command" & cn & ""
cc = cc + 1000
cn = cn + 1
End Sub
|