肯请各位高手帮助我一个刚入门菜鸟.
肯请各位高手帮助我一个刚入门菜鸟.
写的不好,自己改改吧.一个按钮,两个时钟
Dim NumStr As Integer
Dim TxtStr$
Private Sub Command1_Click()
TxtStr = Text1
NumStr = CInt(TxtStr)
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
If NumStr > 0 Then NumStr = NumStr - 1
Text1 = CStr(NumStr)
If NumStr = 0 Then Timer1.Interval = 0: Timer2.Interval = 1000
End Sub
Private Sub Timer2_Timer()
If NumStr < CInt(TxtStr) Then NumStr = NumStr + 1
Text1 = CStr(NumStr)
If NumStr = CInt(TxtStr) Then Timer1.Interval = 1000: Timer2.Interval = 0
End Sub
减了一个时钟控件,这样舒服点
Dim NumStr As Integer
Dim TxtStr$
Dim AddNum As Boolean
Private Sub Command1_Click()
TxtStr = Text1
NumStr = CInt(TxtStr)
If Command1.Caption = "OK" Then
Timer1.Interval = 1000: Command1.Caption = "STOP"
Else
Timer1.Interval = 0: Command1.Caption = "OK": NumStr = 0
End If
End Sub
Private Sub Timer1_Timer()
If Not AddNum Then
If NumStr > 0 Then NumStr = NumStr - 1
If NumStr = 0 Then AddNum = Not AddNum
Else
If NumStr < CInt(TxtStr) Then NumStr = NumStr + 1
If NumStr = CInt(TxtStr) Then AddNum = Not AddNum
End If
Text1 = CStr(NumStr)
End Sub
上面二楼的程序吾以下载的,非常好用.谢谢二位仁兄.
谢谢!!!