473,396 Members | 2,050 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,396 software developers and data experts.

Fire event at particular time

realin
254 100+
Hi friends,

this is my first post in the community, i am making a software, which sends interrupt at parallel port and starts a circuit. Now i am stuck at the point when i want to make it work automatic, like i want to set a particular time of the day and at that time the event should be fired within my program and then the stuff it gotta do.

What should be the approach like ? There should be a listener which checks the time after each second ? But that way it would be resource consuming and now accurate at all..

Please help me :(
Aug 1 '07 #1
5 2049
TRScheel
638 Expert 512MB
Just run the program off windows scheduled tasks. Throw a parameter in there to identify what time it is, or what it should do, etc. Continue from there.
Aug 1 '07 #2
realin
254 100+
Just run the program off windows scheduled tasks. Throw a parameter in there to identify what time it is, or what it should do, etc. Continue from there.
throwing parameter each second is expensive@ resources..

I donn wanna use scheduler.. Please help thanks
Aug 1 '07 #3
realin
254 100+
Any suggestions guys ??
Aug 2 '07 #4
Plater
7,872 Expert 4TB
the scheduler would be the best if you want it to happen at specific times per day.

Although you could do it in your program, pretty easy to I think.
And doing a DateTime.Now really is NOT expensive in the resources.
Like very little if you just sit a loop going:
Expand|Select|Wrap|Line Numbers
  1. while(someCondition)
  2. {
  3.  DateTime mydt=DateTime.Now;
  4.  if (TimeToFire(mydt)==true)
  5.  {
  6.  //do whatever it is you wanted to do
  7.  }
  8.  Thread.Sleep(1000);//wait 1 second
  9.  //you can change that value to slow down or speed up the loop
  10. }
  11.  
Expand|Select|Wrap|Line Numbers
  1. public bool TimeToFire(DateTime mydt)
  2. {
  3.  bool retval=false;
  4.  //do something to decide if the current time is the time you want to fire
  5.  return retval;
  6. }
  7.  
Aug 2 '07 #5
realin
254 100+
the scheduler would be the best if you want it to happen at specific times per day.

Although you could do it in your program, pretty easy to I think.
And doing a DateTime.Now really is NOT expensive in the resources.
Like very little if you just sit a loop going:
Expand|Select|Wrap|Line Numbers
  1. while(someCondition)
  2. {
  3.  DateTime mydt=DateTime.Now;
  4.  if (TimeToFire(mydt)==true)
  5.  {
  6.  //do whatever it is you wanted to do
  7.  }
  8.  Thread.Sleep(1000);//wait 1 second
  9.  //you can change that value to slow down or speed up the loop
  10. }
  11.  
Expand|Select|Wrap|Line Numbers
  1. public bool TimeToFire(DateTime mydt)
  2. {
  3.  bool retval=false;
  4.  //do something to decide if the current time is the time you want to fire
  5.  return retval;
  6. }
  7.  


thanks a lot dude, will give it a try :)
you rock :)
Aug 3 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
9
by: HJ | last post by:
Hi all, I notice that the Form_Dirty event does not fire in Access 2002 (SP-1) when the first character is typed into a new record. In previous versions of Access it does fire. For existing...
7
by: Gordon Smith | last post by:
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows Server 2003 production server. 3 of them work fine. I just installed the 4th one and it's Application_Start event is not...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
11
by: OldProgrammer | last post by:
All the documentation and discussion I have read indicate that the Session_End is not supposed to fire unless you are in "inProc" Session state mode, and then only on Session Timeout or at Session...
7
by: Noozer | last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is enabled, and that the interval is low (4000, which should be 4 seconds). To ensure the timer wasn't being inadvertantly...
2
by: kgadia | last post by:
Hi, I have implemented global exception handler using http module by intercepting the Error event. The code works fine on my machine but the error event fails to fire when deployed on the...
19
by: Daniela Roman | last post by:
Hello, I try to fire an event under a button click event and maybe anybody can give a clue please. I have let's say a WEB grid with PageIndexChanged event: private void...
2
by: Joergen Bech | last post by:
Hope someone has a solution or some suggestions for this. This cannot be right?!? Problem: I have multiple non-modal forms open at the same time. One or more of these forms have a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.