Results 1 to 5 of 5

Thread: Help with Timer?/ Call Commands

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Posts
    118

    Post

    Help Please I posted a question earlier and got some answers but I still cant get it to work.
    I want to call commands 2 to 3 minuits apart. Also I would like them to start over after the last one is done. Here is some of my code if any one could help. Also I need to use other timers.
    Private Sub TimeOut(pInterval As Single)
    Dim sngTimer As Single
    Do While Timer < sngTimer + pInterval
    DoEvents

    Loop

    End SubPrivate Sub Lump()
    Call One
    TimeOut 120
    Call Two
    TimeOut 120
    Call Three
    TimeOut 120
    Call Four
    TimeOut 120
    Call Five
    TimeOut 120
    Call Six
    TimeOut 120
    Call Seven
    TimeOut 120
    Call Eight
    TimeOut 120
    Call Nine
    TimeOut 120
    Call Ten
    TimeOut 120

    End Sub


  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Sure. Try something like this:

    Code:
    Private Sub TimeOut(pInterval As Single)
        Dim sngTimer As Single
        
        Do While Timer < sngTimer + pInterval
            DoEvents
        Loop
    End Sub
    
    Private Sub Lump()
        Do
            Call One
            TimeOut 120
            Call Two
            TimeOut 120
            Call Three
            TimeOut 120
            Call Four
            TimeOut 120
            Call Five
            TimeOut 120
            Call Six
            TimeOut 120
            Call Seven
            TimeOut 120
            Call Eight
            TimeOut 120
            Call Nine
            TimeOut 120
            Call Ten
            TimeOut 120
        Loop
    End Sub
    Then somewhere in the form call your sub routine:

    Call Lump

    ------------------

    Serge

    Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819


  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    I may be missing something, but what does sngTimer do? You Dim it as a single, but never increment it. Why even have it?


  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Oops, you're right.....stupid typo (thats what happens when you type directly into the post)

    Code:
    Private Sub TimeOut(pInterval As Single)
        Dim sngTimer As Single
        
        sngTimer = Timer
        Do While Timer < sngTimer + pInterval
            DoEvents
        Loop
    End Sub
    
    Private Sub Lump()
        Do
            Call One
            TimeOut 120
            Call Two
            TimeOut 120
            Call Three
            TimeOut 120
            Call Four
            TimeOut 120
            Call Five
            TimeOut 120
            Call Six
            TimeOut 120
            Call Seven
            TimeOut 120
            Call Eight
            TimeOut 120
            Call Nine
            TimeOut 120
            Call Ten
            TimeOut 120
        Loop
    End Sub

    ------------------

    Serge

    Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819


    [This message has been edited by Serge (edited 01-31-2000).]

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Posts
    118

    Post

    Thanks for all the help. I do have one more question though. For some reason my other timers don't work properly. could it be because of the TimeOut function? If so how would I fix this?
    Thanks again


    Originally posted by Serge:
    Oops, you're right.....stupid typo (thats what happens when you type directly into the post)

    Code:
    Private Sub TimeOut(pInterval As Single)
        Dim sngTimer As Single
        
        sngTimer = Timer
        Do While Timer < sngTimer + pInterval
            DoEvents
        Loop
    End Sub
    
    Private Sub Lump()
        Do
            Call One
            TimeOut 120
            Call Two
            TimeOut 120
            Call Three
            TimeOut 120
            Call Four
            TimeOut 120
            Call Five
            TimeOut 120
            Call Six
            TimeOut 120
            Call Seven
            TimeOut 120
            Call Eight
            TimeOut 120
            Call Nine
            TimeOut 120
            Call Ten
            TimeOut 120
        Loop
    End Sub

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