Private Function SecToTime(ByVal lngSec As Long) As String Dim lngMin As Variant lngMin = Format(Fix(lngSec / 60), "00") SecToTime = Format(Fix(lngMin / 60), "00") & ":" & _ Format(lngMin Mod 60, "00") & ":" & _ Format(lngSec Mod 60, "00") End Function
Private Sub Command1_Click() With Timer1 If .Interval = 0 Then .Interval = 1000 '<-- 1 sec .Enabled = True Command1.Caption = "Stop" Else .Interval = 0 .Enabled = False Command1.Caption = "Start" End If End With lngCount = 0 End Sub
Private Sub Form_Load() Timer1.Interval = 0 Command1.Caption = "Start" Text1.Text = "00:00:00" End Sub
Private Sub Timer1_Timer() lngCount = lngCount + 1 Text1.Text = SecToTime(lngCount) '<-- Viser tiden End Sub '-------------------------------------- Form1 --------------------------------------
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.