PDA

Click to See Complete Forum and Search --> : About Timer


Nkao
Nov 16th, 1999, 10:46 PM
Can we set the timer interval more than 1 minute ? like 5 minutes ? or any timer control can do this ?

Inhumanoid
Nov 16th, 1999, 10:54 PM
Do something like this:

Set the timer to one minute...
inside the timer increment a static integer.
when that integer reaches f.i. 5. you know that 5 minutes have passed..

So then again inside the timer do an if statement:

if i > 4 then 'where i is your static integer
'do yer stuf
endif

Inhumanoid
Nov 16th, 1999, 10:56 PM
Oeps.. don't forget to reset the static integer inside the if statement....

hasty Inhumanoid

Aaron Young
Nov 16th, 1999, 10:56 PM
The Timer Control only goes just over a Minute, but you can use it with the Timer Function to wait any Interval you like, eg.

Private Sub Form_Load()
'Set the Timer Control Interval to Less than a Minute
'The Higher the Value the Less Accurate it generally becomes.
Timer1.Interval = 1000
Timer1_Timer
End Sub

Private Sub Timer1_Timer()
Static tTimer As Single
'Check the difference between tTimer and Timer
'to get any Time Interval you want.
If tTimer = 0 Then tTimer = Timer
If (Timer - tTimer) >= 300 Then '5 Mins
MsgBox "5 Minutes have passed."
tTimer = Timer 'Reset for another 5 Mins
End If
End Sub



------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net