How to run the program at particular time? It should run
everyday at 3:00 PM. After executing the program should
sleep until next day at 3:00 PM. Please explain with code?
Answer Posted / renu
Here is the code that you expected.
public static void Main()
{
Timer timer = new Timer();
timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
timer.Interval = Convert.ToDouble
(ConfigurationManager.AppSettings["TimerInterval"]) * 1000;
timer.Enabled = true;
}
private void OnElapsedTime(object source, ElapsedEventArgs
e)
{
timer.Enabled = false;
//Call your business logic here
timer.Enabled = true;
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is the use of static members with example using c#.net.
What are callback methods in c#?
Explain the difference between a namespace and assembly name in .net?
What is difference between write and writeline?
What is the file extension for c#?
Why to use “finally” block in c#?
Is it possible to have a static indexer in c#?
Is string value type c#?
What is object array in c#?
What is the use of 0 in c#?
What are the Features in .net framework 1.1
Can a class be protected in c#?
what is a structure in c#
When a Static Constructor is called in a Class?
Can we change static value in c#?