Hi, I am making a programme where I use a timer, I have 2 command buttons, one starting the timer, another stopping the timer, currently this works. But when i press the comand button starting the timer I want to have it reset to 0 because at the moment it carries on from where it left off when I pressed stop. I am not amazing at VB so all my code is simple and I don't know how to reset the timer to 0 before it starts off counting again.
Please hope you can help!!
Thanks

But that just seems to stop the timer altogether! Because isn't the interval proptery when on the timer the milliseconds between when the timer increases the time by a prespecified amount, or do i have that wrong?

timer.value = 0 ?

There is no Value property in a VB 6 timer.

The Interval property specifies the number of milliseconds between calls to a Timer control's Timer event. For example, if set to 10, the Timer1.Timer event will exceute every 10 milliseconds. Disabling a Timer control by setting Enabled to False cancels the countdown set up by the control's Interval property.

I would try setting the Interval property and the Enabled property to True in the code for your Start button, and set these to 0 and False in your Stop button. According to Microsoft, "When a Timer control is enabled, its countdown always starts from the value of its Interval property setting."

ok, thanks it's working!

You simply need to enable and disable the timer.

if you just enable and disable to timer it carries on counting from the ime it got disabled at , eg if it got disabled at 1.4 and then i enabled it again it would count 1.5, 1.6 etc

You need to maintain some counter.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.