Stopwatch timer

xiaoxiao2021-03-06  134

Implement timer with VB

Option ExplicitDim startime As VariantDim passtime As VariantDim endtime As VariantDim msec As VariantDim sec As VariantDim mn As Variant_____________________________________________________Private Sub Cmdstar_Click () startime = Now Lbl4.Caption = Format (startime, "hh: mm: ss ampm") Lbl5.Caption = "" Cmdstar.Enabled = False Cmdstop.Enabled = True timTimeshow.Enabled = True msec = 0 sec = 0 mn = 0End Sub_____________________________________________________Private Sub Cmdstop_Click () endtime = Now Lbl5.Caption = Format (endtime, "hh: mm: ss ampm") Cmdstar .Enabled = True Cmdstop.Enabled = False timTimeshow.Enabled = False msec = 0 sec = 0 mn = 0End Sub_____________________________________________________Private Sub timTimeshow_Timer () Dim h As String msec = msec 1 If msec = 60 Then msec = 0 sec = sec 1 End if if sec = 60 Then sec = 0 mn = Mn 1 end if IF mn> = 60 THEN MN = 0 end if if IF SEC <10 Then Lbltime.caption = "0" & ​​Mn & ": 0" & Sec & ":" & msec End IF IF MN <10 Then Lbltime.caption = "0" & ​​Mn & ": 0" & Sec & SEC & ":" & msec end if 'passtime = mn & ":" & sec ":" & msec' lbltime.caption = Format (Passtime, "HH: mm: SS") End Sub

转载请注明原文地址:https://www.9cbs.com/read-127490.html

New Post(0)