OOP Question

  • Thread starter Thread starter Sharrukin Amiri
  • Start date Start date
S

Sharrukin Amiri

Can you implement a Timer in a class module to that the method of that class
fires roughly every 2 seconds? I am trying to avoid looping because it uses
a lot of CPU time.

do
.....
loop

Thanks!
 
Yes, you can use System.Threading.Timer, which, according to the
documentation
"Provides a mechanism for executing a method at specified intervals."

There are actually 3 different timers available in .NET:
System.Threading.Timer
System.Timers.Timer
System.Windows.Forms.Timer

and each has its appropriate usage. See this article for more details
on which to choose:
http://www.ftponline.com/vsm/2001_12/online/online_eprods/vsnet_jlowy/


Joshua Flanagan
http://flimflan.com/blog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top