WithEvents问题
想使用Timer控件但是不想直接拖控件,代码如下
'dim WithEvents x as New Timer '出错
dim WithEvents x as Timer
Set x=New Timer '出错
应该怎样写才是正确的使用方法
Option Explicit Dim WithEvents x As Timer Private Sub Form_Load() Set x = Me.Controls.Add("VB.Timer", "myTimer") x.Interval = 1000 x.Enabled = True End Sub Private Sub x_Timer() Debug.Print "timer..." End Sub