Hi! I need to make a counter that doesn't use the clock time.
And I need that when it gets to 60 seconds, it starts like 00:01:00, and when it gets to 60 minutes, it gets 01:00:00, and so on, like a real clock.
Is it clear??
Thank you!!
Printable View
Hi! I need to make a counter that doesn't use the clock time.
And I need that when it gets to 60 seconds, it starts like 00:01:00, and when it gets to 60 minutes, it gets 01:00:00, and so on, like a real clock.
Is it clear??
Thank you!!
Is this what you want?
Code:Private Sub Command1_Click()
Time = "00:00:00"
Do
Label1.Caption = Format(Time, "hh:nn:ss")
DoEvents
Loop
End Sub
and what is wrong with the example given?
It does what you want does it not?
Maybe you could use timeserial function
Code:static n&
timeserial(0,0,n)
n=n+1
:confused:
It starts from 00:00:00 and goes up:
00:00:01
00:00:02
00:00:03
00:00:04
00:00:05
00:00:06
00:00:07
00:00:08
00:00:09
00:00:10
'^seconds
....
00:01:00
00:02:00
00:03:00
00:04:00
00:05:00
00:06:00
00:07:00
00:08:00
00:09:00
00:10:00
'^minutes
01:00:00
02:00:00
03:00:00
04:00:00
05:00:00
06:00:00
07:00:00
08:00:00
09:00:00
10:00:00
'^hours
Is that not what you wanted?
Kids these days, back in my day...we took what we were given, no questions asked :rolleyes:.
Ok. It does, in part, what I need: it counts like that, but it modifies the CPU time, and I don't want it.
I need it to count, like it does but not using or modifying in any way, the CPU time. Am I clear? I hope so. I know my english may not be so clear as I'd like, but...
Thank You!!
put my code in a timer with interval set to 1000
Here it is the old-fashoined way... Put a label and a timer on a form and paste the following code into the form's code window. (Use the default names for the controls).
This should give you the functionality that you are looking for without using the system time, Time function, or any other intrinsic "stuff"...
Hope that helps!Code:Option Explicit
Private Sub Form_Load()
Label1 = "00:00:00"
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Static intSecond As Integer
Static intMinute As Integer
Static intHour As Integer
intSecond = intSecond + 1
If intSecond = 60 Then
intSecond = 0
intMinute = intMinute + 1
End If
If intMinute = 60 Then
intMinute = 0
intHour = intHour + 1
End If
If intHour = 13 Then intHour = 1
DisplayTime intHour, intMinute, intSecond
End Sub
Private Sub DisplayTime(intHour As Integer, intMinute As Integer, intSecond As Integer)
Dim strTime As String
If intHour < 10 Then strTime = strTime & "0"
strTime = strTime & intHour & ":"
If intMinute < 10 Then strTime = strTime & "0"
strTime = strTime & intMinute & ":"
If intSecond < 10 Then strTime = strTime & "0"
strTime = strTime & intSecond
Label1 = strTime
End Sub
[Edited by seaweed on 11-08-2000 at 01:37 AM]