Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2006

Tip: Looking for answers? Try searching our database.

System.Windows.Forms.Timer.Reset() ???

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mikeachamberlain@gmail.com - 22 Jun 2006 08:45 GMT
Hello.

Why is there no Reset() method on the windows forms timer?  Calling
Start() then Stop() only disables the raising of events for this
period.  It doesn't reset the timer back to 0.  For instance, I have a
timer that elapses every 30 seconds, let it run for 10 seconds, stop it
for 10 seconds, then start it again, the next is event is raised in
another 10 seconds, instead of 30 seconds as I'd expect it to be.

I know I can work around it, which involes adding a DateTime variable
to my page, setting it, and using a timer to check it against the
current time.  However, this is pretty annoying.

Why no Reset() method?

Mike
Stoitcho Goutsev (100) - 22 Jun 2006 14:39 GMT
Mike,

I believe the windwos form timer works exactly how you expected. When you
srart the timer it raises the event after the period of time the timer is
set up with.

You correctly expect the timer to come after 30 sec again.

I created a test application and tested your scenario - I started the timer,
let it run for 10 sec, stopped it, waited 10 sec, started it again. The tick
even came 30 sec after I started for the second time.

I believe you are doing something wrong there. Make sure that you call Stop
or set Enabled to false. If you call two times Start in a row the second
start doesn't reset the timer

Signature

HTH
Stoitcho Goutsev (100)

> Hello.
>
[quoted text clipped - 12 lines]
>
> Mike

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.