Resetting a timer in VB6


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405

    Default Resetting a timer in VB6

    Is there some way to reset a timer in VB6?

    What I need to do is reset a timer to zero each time a button is clicked. When the timer
    interval is reached, it clears a text box, but I need to reset the timer if another button is
    clicked before the timer interval is reached. Is this do-able?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Is there some way to reset a timer in VB6?
    If you're talking about the TIMER control, wouldn't disabling and then re-enabling it reset it to zero?

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Nope. It just disables the timer event. It will fire at odd times once it's re-enabled because
    it's not being reset to zero.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Nope. It just disables the timer event. It will fire at odd times once it's re-enabled because it's not being reset to zero.
    Timer - as in timer that counts from 0 to 86400 during a day?
    Or..
    Timer - as in timer that will fire off an event every X milliseconds?
    If it's the 1st one, I thought that one was driven by the 8259(or whatever it's equivalent is these days), a BIOS sort of thing that can't be reset with doing a 2 fingered salute (CMOS jumper reset )
    Last edited by skimask; - 21st July 2008 at 23:18. Reason: Had my numbers (1st and 2nd) backwards

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I have a VB form with multiple buttons. When a user presses a button, it prints the button
    value to a text box. Button values range from 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

    The text box needs to be cleared after a timeout period of around 15 seconds, but only if
    no other buttons are pressed during this time interval.

    I.E. the user can enter 1, and it clears in the text box after 15 seconds. But if the user
    enters 1, 2, 3, then the timer interval should be reset to zero after button #3 is pressed
    so 123 in the text box is cleared in 15 seconds.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    Bruce -
    Disable the timer, then set the interval property back to whatever you need.
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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