473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 2809
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
1
by: agro_r | last post by:
I use this code in my program: while(form.Created) { form.CheckTime(); Application.DoEvents(); }
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
18
by: Max | last post by:
This is a follow-up on my previous thread concerning having the program wait for a certain date and time and then executing some code when it gets there. My question is; can I use the Sleep...
0
by: Tiraman | last post by:
Hi , i m getting the following errors under the eventlog while i m trying to run some class that i wrote. at the first i got an error about the just-in-time : access denied and i added the...
11
by: chopsnsauce | last post by:
Here's the example: Dim frm As New FORM1 Try frm.show Catch ex As Exception msgbox ex.message
1
by: brad.serbus | last post by:
I am trying to figure out a way to have health monitoring throw different Event IDs into the event log, and am having a hard time. None of the customization that I have looked through so far has...
3
by: assgar | last post by:
Hi I am having problem with my loping. I don't know if I have chosen the correct approach. GOAL: I need to insert into a table event types for a specific date range. The calendar the event...
7
by: wanwan | last post by:
Hi, I'm looking for a better way to do a date/time elapsed event rather than a timer elapsed event. Currently, I wrote my program to use a timer elapsed event set to 1 second, and it checks...
4
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.