2个回答
展开全部
代码在线添加控件。
Dim WithEvents Text1 As TextBox
Dim WithEvents Label1 As Label
Dim WithEvents Command1 As CommandButton
'注意:这三句必须是全局声明,也就是在代码的最顶端通用的部分
Private Sub Form_Load()
Set Text1 = Me.Controls.Add("VB.TextBox", "Text1")
With Text1
.Visible = True
.Top = 0 '位置可以自己换大小也可以自己换,都不填就是默认的
.Left = 0
End With
Set Label1 = Me.Controls.Add("VB.Label", "Label1")
With Label1
.Visible = True
.Caption = "命令"
End With
Set Command1 = Me.Controls.Add("VB.CommandButton", "Command1")
With Command1
.Visible = True
.Caption = "按钮1"
End If
End Sub
Dim WithEvents Text1 As TextBox
Dim WithEvents Label1 As Label
Dim WithEvents Command1 As CommandButton
'注意:这三句必须是全局声明,也就是在代码的最顶端通用的部分
Private Sub Form_Load()
Set Text1 = Me.Controls.Add("VB.TextBox", "Text1")
With Text1
.Visible = True
.Top = 0 '位置可以自己换大小也可以自己换,都不填就是默认的
.Left = 0
End With
Set Label1 = Me.Controls.Add("VB.Label", "Label1")
With Label1
.Visible = True
.Caption = "命令"
End With
Set Command1 = Me.Controls.Add("VB.CommandButton", "Command1")
With Command1
.Visible = True
.Caption = "按钮1"
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询