Dim WithEvents Cmmand1 As CommandButton
Private Sub Cmmand1_Click()
MsgBox "Hello world!", vbInformation, Me.Caption
End Sub
Set Cmmand1 = Me.Controls.Add("VB.CommandButton", "cmmand1")
With Form1!Cmmand1
.Visible = True
.Top = 1000
.Width = 2000
.Caption = "点我!!"
End With
Private Sub Cmmand1_Click()
MsgBox "Hello world!", vbInformation, Me.Caption
End Sub
Set Cmmand1 = Me.Controls.Add("VB.CommandButton", "cmmand1")
With Form1!Cmmand1
.Visible = True
.Top = 1000
.Width = 2000
.Caption = "点我!!"
End With
解决方案 »
- 我想用WINSOCK控件输出内容后,再自动点击一个按钮,但是不成功?
- 用VB怎么做Service?
- 怎样对已知文件夹中的文件进行查找??
- 这个200分问题没人能解决吗
- 图形问题,请教!100分+300元人民币!等了18天了!
- 新手 请教一个关于VB与单片机通讯的问题 一直在线等 拜托了 急呀!!!!!!!!!!最好用QQ
- 如何实现对Excl表格进行数据库导入、导出操作?我用的SQLServer
- 请问 能在.dll应用timer控件 急急急急急急!!
- 如何注册自己的OCX控件
- 在ifix中 添加DTpicker 控件 ,用来显示时间 运行提示 microsoft access driver 参数不足, 期待是1
- to playyuer 急!
- 如何使ID自动增加1
Dim WithEvents Cmmand1 As CommandButton
Private Sub Cmmand1_Click()
MsgBox "Hello world!", vbInformation, Me.Caption
End SubPrivate Sub Command1_Click()
Set Cmmand1 = Me.Controls.Add("VB.CommandButton", "cmmand1")
With Form1!Cmmand1
.Visible = True
.Top = 1000
.Width = 2000
.Caption = "点我!!"
End WithEnd Sub
Private WithEvents ctlSelf1 As VBControlExtender
...
...
...
Private WithEvents ctlSelf100 As VBControlExtender
天哪,救命啊!
万一我加到了101怎么办?
http://www.csdn.net/Expert/topic/472/472455.shtm
高手来钓亮MM
这样定义吗?
然后再在下面这样?
Rim Preserve ctlSelf(100)
set ctlself(100) = Controls.Add("VB.CommandButton", "cmmand1",form1)然后这个事件这样:
Private Sub ctlSelf_ObjectEvent(Info As EventInfo,Index as Integer)
If Info.Name = "GetFocus" Then
msgbox "It's Error!"
End If
End Sub
可是这样是错的,错的,错的错的
然后COPY它,再粘贴,VB就会提示你是否建立控件数组,
然后,再把TEXT1(1)删除,只留下TEXT1(0),就好了。
如果要动态加载一个的话,就如下:
LOAD TEXT1(I) 'i从1算起!