Small example: we have a simple form with this code:
Code:
Private startDate As Date
Private secAuto As Integer
Private secSys As Integer
Private Sub cmd_start_Click ()
secAuto = 0
secSys = 0
startDate = Now
Timer_auto.Enabled = True
Timer_sys.Enabled = True
End Sub
Private Sub Timer_auto_Timer ()
secAuto = secAuto + 1
lbl_auto.Caption = secAuto
End Sub
Private Sub Timer_sys_Timer ()
secSys = DateDiff ( "s", startDate, Now)
lbl_sys.Caption = secSys
End Sub
Timer_auto mark time "for her", the marks Timer_sys while interrogating every second the system date. Within the first 3 minutes the two timers have a difference of 1 second.
If you want to be always synchronized with the system using the second method (Timer_sys). Furthermore, it is not necessary to hold the 1000 range of Timer_sys, but since the increase is always done on a comparison with the timer system, you can use more specific intervals (50 ...)
Bookmarks