Results 1 to 4 of 4

Thread: About Timer

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    2

    Post

    Can we set the timer interval more than 1 minute ? like 5 minutes ? or any timer control can do this ?

  2. #2
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309

    Post

    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



  3. #3
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309

    Post

    Oeps.. don't forget to reset the static integer inside the if statement....

    hasty Inhumanoid

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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.
    Code:
    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
    [email protected]
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width