利用VB制作一个秒表

来源:互联网 发布:mysql client for mac 编辑:程序博客网 时间:2024/06/05 05:33
Dim m As Integer, s As Integer, ms As Integer, flag As BooleanPrivate Sub Command1_Click()If flag = False ThenTimer1.Interval = 10flag = TrueElseTimer1.Interval = 0flag = FalseEnd IfEnd SubPrivate Sub Command2_Click()flag = FalseTimer1.Interval = 0m = 0s = 0ms = 0Label1.Caption = "00:00:00"End SubPrivate Sub Timer1_Timer()ms = ms + 1If ms = 100 Thens = s + 1ms = 0End IfIf s = 60 Thenm = m + 1s = 0End IfLabel1.Caption = Format(m, "00:") & Format(s, "00:") & Format(ms, "00")End Sub