469,610 Members | 1,494 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

Subcribing to a time event

I use this code in my program:
while(form.Created)
{
form.CheckTime();
Application.DoEvents();
}
because I want my program to provide notifications on a specific time.
The problem is, that loop caused the CPU usage to be always 100%. I
don't want to sacrifice all the CPU cycle just for that task.

Isn't there a better way to do the equivalent of:

"If time is X, then call method D"

and have the system (os) raise the event (call method D) for my
program?

Thanks a lot.

Nov 16 '05 #1
1 2642
How about using the System.Windows.Forms.Timer class/component?

"agro_r" <ag***************@yahoo-dot-com.no-spam.invalid> wrote in message
news:40**********@127.0.0.1...
I use this code in my program:
while(form.Created)
{
form.CheckTime();
Application.DoEvents();
}
because I want my program to provide notifications on a specific time.
The problem is, that loop caused the CPU usage to be always 100%. I
don't want to sacrifice all the CPU cycle just for that task.

Isn't there a better way to do the equivalent of:

"If time is X, then call method D"

and have the system (os) raise the event (call method D) for my
program?

Thanks a lot.

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by luscus | last post: by
1 post views Thread by agro_r | last post: by
reply views Thread by Tiraman | last post: by
1 post views Thread by brad.serbus | last post: by
7 posts views Thread by wanwan | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.