TO 回复人: qxzhu(雨滴) ( ) 信誉:100 2005-06-24 09:45:00 得分: 0
你的代码应该这样改一下
For i = 0 To Controls.Count-1
if Me.Controls(i).Name="button1" then 'Text是可变的
.........
endif
应该为
Dim objButton As Control '定义成具体类型是不能遍历的
For Each objButton In Me.Controls
If TypeOf objButton Is Button Then
If objButton.Name = "Button1" Then
'TODO: ...
End If
End If
Next
Dim objButton As Button
For Each objButton In Me.Controls
If TypeOf objButton Is Button Then
If objButton.Name = "Button1" Then
'TODO: ...
End If
End If
Next