|
-
Apr 8th, 2000, 11:46 PM
#1
Thread Starter
Junior Member
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 
Life's hard, but the front of a train is harder 
-
Apr 9th, 2000, 12:25 AM
#2
Addicted Member
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
-
Apr 9th, 2000, 12:54 AM
#3
Thread Starter
Junior Member
Yes! Thank you it worked 
-----------------------------
E-Mail: [email protected]
ICQ UIN#: 31619676
Life's hard, but the front of a train is harder 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|