求助!button 作为参数传递,类型不功不匹配
如新建一个标准工程,添加一控件button 名为 cmdButton1,把cmdButton1作为参数传给TestSub,报 "Run-time error '13 ':type mismatch ",重装系统前还是好的,现在不知道少了些什么东东就变的不能用了,还望高手不吝赐教,谢了先!
代码如下:
'引用了控件:Microsoft windows common controls 6.0(sp6)
Private Sub Form_Load()
TestSub cmdButton1
End Sub
Private Sub TestSub(ByVal cmdTestButton As Button)
MsgBox cmdTestButton.Caption
End Sub
[解决办法]
'引用了控件:Microsoft windows common controls 6.0(sp6)
Private Sub Form_Load()
TestSub cmdButton1
End Sub
Private Sub TestSub(Byref cmdTestButton As Button)
MsgBox cmdTestButton.Caption
End Sub
------------------------
button是类对象,不能传值,应该传址