How do I display a live clock, updated every second, that shows how long you have been running the current application? Come on guys, I know it's possible...
------------------
Webmaster Czaries
http://www1.50megs.com/css
Printable View
How do I display a live clock, updated every second, that shows how long you have been running the current application? Come on guys, I know it's possible...
------------------
Webmaster Czaries
http://www1.50megs.com/css
I don't understood very well, you want put this code in your form/mdi or in a clock out the app, like allways visible?
Jefferson
Put a timer on the form and set it's interval to 100. Then do the following:------------------Code:Private Sub Timer1_Timer()
Static m_dTotal As Double
Static m_dStart As Double
Static m_dCurrent As Double
Dim x As Integer
m_dStart = Timer ' Set start time.
Do
m_dCurrent = Timer - m_dStart
x = x + 1
If x = 500 Then
Text1.Text = "Working for " & HoursAndMinutes(m_dTotal + m_dCurrent)
x = 0
End If
DoEvents ' Yield to other processes.
Loop
End Sub
Marty
I forgot to include the HoursAndMinutes routine. Here it is.
Code:Public Function HoursAndMinutes(dSeconds) As String
HoursAndMinutes = Format(dSeconds \ 3600, "00") & ":" _
& Format(((dSeconds \ 60) Mod 60), "00") & ":" _
& Format(dSeconds Mod 60, "00")
End Function
------------------
Marty
Thank you guys, and I did mean display it on a form.
------------------
Webmaster Czaries
http://www1.50megs.com/css
Thank You for the correction. I was wondering why it kept giving me an error...
------------------
Webmaster Czaries
http://www1.50megs.com/css