I've got a question.
I'm making a program, but I want the time the program is running (NOT windows) to be displayed in a label, and I just can't figure out how to do this.. arghl.
Does NE1 have an idea? Thnx ;)
Printable View
I've got a question.
I'm making a program, but I want the time the program is running (NOT windows) to be displayed in a label, and I just can't figure out how to do this.. arghl.
Does NE1 have an idea? Thnx ;)
This is real quick and is not optimized in any way, but this will do the trick. Put a timer control (tmrTimeCheck) on your form and an elapsed time label (lblElapsedTime) on your form.
Code:Option Explicit
Public startTime As Variant
Public curTime As Variant
Public runTime As Variant
Private Sub Form_Load()
'Set Timer Interval and Enable it.
tmrTimeCheck.Interval = 1000
tmrTimeCheck.Enabled = True
'Get the current time and time program started
curTime = Now
startTime = curTime
End Sub
Private Sub tmrTimeCheck_Timer()
'update current time variable
curTime = Now
'calculate amount of time your app has been running
runTime = curTime - startTime
'display elapsed time in a label.
lblElapsedTime.Caption = Format(runTime, "hh:mm:ss")
End Sub
Yes! Thank you it worked ;)
-----------------------------
E-Mail: [email protected]
ICQ UIN#: 31619676