Private WithEvents lbl As Label Private Sub Command1_Click()
Set lbl = Me.Controls.Add("VB.Label", "Label1")
With lbl
.Move 0, 0
.Width = 400
.Height = 200
.Caption = "Hello"
.Visible = True
End With
End Sub这样创建的控件,如果要删除他,怎样删除呢?
Set lbl = Me.Controls.Add("VB.Label", "Label1")
With lbl
.Move 0, 0
.Width = 400
.Height = 200
.Caption = "Hello"
.Visible = True
End With
End Sub这样创建的控件,如果要删除他,怎样删除呢?
With cmdObject
.Caption = "Dynamic CommandButton"
.Default = True
.Enabled = True
.FontSize = 10
.Height = 600
.Visible = True
.Width = 3000
.Move 1000, 1000
End WithEnd SubPrivate Sub mnuRemove_Click() Controls.Remove cmdObject Set cmdObject = NothingEnd Sub