# 请问各位高手！有关于timer 的问题！(请内详)

Posted by 露脚 on November 12, 1999 at 23:06:06:

程式码如下所示：
Dim bp1 As Byte
Private Sub Command1_Click()
Debug.Print "=== command1 ====="
Debug.Print " ==== call Show===="
Call Show1(1)
Call Show1(2)
End Sub

Private Sub Show1(ByVal bp As Byte)
bp1 = bp
Debug.Print " ====== into Show ======"
For i = 0 To 100
For j = 0 To 100
Next j
Next i

If bp = 1 Then
Debug.Print " ==== Set timer1 ======"
Timer1.Enabled = True
Timer1.Interval = 100

Debug.Print " ==== Set timer2 ======"
Timer2.Enabled = True
Timer2.Interval = 100
End If
Debug.Print " ==== Quit Show ======"

End Sub

Private Sub Timer1_Timer()

If stopa = 2 Then Exit Sub
If bp1 = 1 Then
Debug.Print " ====== into Timer1 bp1=1======"
For i = 0 To 2
For j = 0 To 2
Next j
Next i
Debug.Print " ====== Quit Timer1 ======"
stopa = stopa + 1
End If
End Sub

Private Sub Timer2_Timer()
Static stopa As Byte
If stopa = 2 Then Exit Sub
If bp1 = 2 Then
Debug.Print " ====== into Timer1 bp1=2======"
For i = 0 To 2
For j = 0 To 2
Next j
Next i
Debug.Print " ====== Quit Timer2 ======"
End If
stopa = stopa + 1
End Sub

Follow Ups:

- 补充！如何让程式能够执行到第一个 call 呢！还是它是错误的！ 露脚 23:08:51 11/12/99 (2)
  - Re: 补充！如何让程式能够执行到第一个 call 呢！还是它是错误的！ ellis 08:56:07 11/13/99 (1)
    - thanks！小弟已用do...loop 解决！ thanks ！(无内文) 露脚 07:10:00 11/14/99 (0)