菜鸟问题,在线等待,立即给分。
窗体中:
Option Explicit
Private WithEvents TempTimer As VB.Timer
Private Sub Form_Load()
Set TempTimer = Controls.Add( "VB.Timer ", "MyTimer ")
TempTimer.Enabled = False
TempTimer.Interval = 500
Call MySub
End Sub
Private Sub TempTimer_Timer()
Print "OK "
End Sub
模块中:
Option Explicit
Public Sub MySub()
Form1.TempTimer.Enabled = True
End Sub
执行报错:未找到方法或数据成员
请高手指教,谢。
[解决办法]
窗体中
Public WithEvents TempTimer As VB.Timer
模块中
Public Sub MySub()
Load Form1 '触发 Form_Load 事件载入 TempTimer 控件
Form1.TempTimer.Enabled = True
End Sub