Results 1 to 5 of 5

Thread: Timer stuff

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    12
    Is there a way to reset the timer interval without waiting for the full interval the elaps before the changes are made?

    First i tried

    tmr.Enable = False
    tmr.Enable = True

    However, I found that this only works some times but not all the time... and now for some odd reason, it don't work at all to reset the interval right away! Any Ideas?


    Another thing, is there a way to force a small piece of code (2 or 3 lines) to execute one after another without having the timer event interupting it? So wait until it finishes those 2 lines before going into the timer event?

    Thanx in advance...

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    12
    So can i temporarily disable the timer and after the 2 lines, enable it again... will it still remember the timer interval? or can i retreive the remaining interval before disabling it then set the interval back in?

  3. #3
    Junior Member
    Join Date
    Nov 1999
    Location
    Forsyth, GA, USA
    Posts
    26

    Timer

    The Enabled property should work for this. I haven't had any problem like this.(Try using a "refresh" method immediately after changing the property.)

    For the second, in the timer event you can disable the timer control until the timer procedure finishs. When the code in the timer event is done, Enable it again. You could also check the state of a global variable to temporarily disable the timer procedure(or delay it.).
    Brad
    Contract Developer

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Timer is very inaccurate, upto 53 milliseconds so anything could cause the intervals won't work but the event won't fire within code unless you have a doevents statement. Also your event's will stop firing as soon as you turn it of but it won't exit the event for that sake
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Guest
    To exit a Timer interval without having it finish, you can use Exit Sub.

    Code:
    Private Sub Timer1_Timer()
    
        Timer1.Enabled = False
        Exit Sub    '**The Sub ends here**
        
        Print "End of Sub"
    
    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