how can I make a time counter?
Printable View
how can I make a time counter?
You'd have to be much more descriptive than that - what time you need to count, interval (seconds, minutes, hours, days ...) ...
I think this is what he's talking about.
No that's a diffrent project...
I am building an app to connect to MySQL Server and I wan't to put in the status bar a clock counter to count how much time the user is connected to the remote databse...
p.s.
The format of the clock is like this: 00:00:00
Put a timer control on your form and copy/paste this sample:
VB Code:
Private Sub Form_Load() Timer1.Interval = 1000 Timer1.Enabled = True Label1.AutoSize = True Label1.Caption = "Elapsed time since login: 00:00:00" End Sub Private Sub Timer1_Timer() Static lSeconds& Dim sTime$ lSeconds = lSeconds + 1 sTime = Str$(lSeconds \ 3600) & ":" & _ Str$(lSeconds \ 60) & ":" & _ Str$(lSeconds Mod 60) Label1.Caption = "Elapsed time since login: " & Format(CDate(sTime), "hh:nn:ss") End Sub
Thanks RhinoBull!
Not at all. Any time. :wave: