2013年6月6日 星期四

VB6 Timer元件Interval限制65535

利用compare來存秒數,這裡Timer Interval設1000(代表1秒)

Public myCount, compare

Private Sub Form_Load()
    myCount = 0
    compare = 0
End Sub
Private Sub Command1_Click()
    compare = Text2.Text
    Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
    Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
    myCount = myCount + 1
    Text3.Text = myCount
   
    If myCount = Val(compare) Then
        myCount = 0
        Call 副程式
    End If
End Sub

沒有留言:

張貼留言