如何用VB语句创建一个对象?

比如一个窗体,一个按钮等
2025-04-16 05:39:33
推荐回答(2个)
回答1:

楼上说的很对,尤其要注意将Visible属性设置为True.

回答2:

以按钮为例
Dim cmdStart As CommandButton
Set cmdStart = Controls.Add("VB.CommandButton", "cmdStart", Me)
With cmdStart
.Caption = "创建对象"
.Font.Size = 12
.Left = 1000
.Top = 1000
.Width = 1500
.Height = 600
.Visible = True
End With