Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer pause/resume

Status
Not open for further replies.

jrwinterburn

IS-IT--Management
Jul 26, 2004
72
GB
Hi guys,

Sadly, a newbie question for you! I've just started playing with the timer in vb.net and am trying to use a start/pause/resume button to start/pause/resume a progress bar I am using. I can make it start and stop the progress bar (so it appears to pause halfway through for example) but when I click start again, it starts from the beginning, obviously.

It seems the timer control does not have a pause() or resume(). I wish to be able to get the progress bar to continue from where it paused. Additionally, I want it to loop - should the progress bar get to the end before being paused, it shoud begin again.

Any help would be appreciated as I'm stuck here!

Thanks.

Jon
 
You don't need a pause on the timer as that is simply the sam as Stop. What you should do is create a variable that holds the value of the progress bar. When the timer fires, it increments this value and updates the progress bar to this value. Stopping the timer (i.e. your pause button) will mean that the value simply remains the same and therefore "pauses" the progress bar.

As for the loop, once the value gets to the highest value that the progress bar accepts, simpyl reset the conter to 0.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top