我已经通过下面方法实现生成按钮数组,求教怎样实现对按钮操作?
Dim myCmd(10) As CommandButton
Private Sub form_load()
Dim i%
For i = 0 To UBound(myCmd)
Set myCmd(i) = Form1.Controls.Add("vb.CommandButton", "cmd" & i & "")
myCmd(i).Width = 500: myCmd(i).Height = 300
myCmd(i).Left = 100 + 800 * i
myCmd(i).Top = 500
myCmd(i).Visible = True
Next
End Sub
Dim myCmd(10) As CommandButton
Private Sub form_load()
Dim i%
For i = 0 To UBound(myCmd)
Set myCmd(i) = Form1.Controls.Add("vb.CommandButton", "cmd" & i & "")
myCmd(i).Width = 500: myCmd(i).Height = 300
myCmd(i).Left = 100 + 800 * i
myCmd(i).Top = 500
myCmd(i).Visible = True
Next
End Sub
没有母体添加就是注册的问题,VB里面没用过
.net里面指定按钮事件函数地址就能用了。VB是不是差不多啊,你试试吧
AddHandler objBtn.Click, AddressOf btnMount_ClickPrivate Sub btnMount_Click(ByVal sender As Object, ByVal e As System.EventArgs)
处理处理
End Sub