Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

what are the different ways a method can be overloaded?

878


Can int be null in c#?

829


How many types of constructors are there?

831


Give some examples for built in datatypes in c#?

909


What are c# i/o classes? What are the commonly used i/o classes?

872


What is the CTS, and how does it relate to the CLS?

941


What do you understand by 'access specifiers' in C#?

851


Why would you use untrusted verification?

876


What is difference between string and stringbuilder in c#?

886


What is the namespace for the thread class?

886


Define constructors

889


What is generic delegate in c#?

870


Structs are not reference types. Can structs have constructors?

916


What is the difference between namespace and class in c#?

895


What is the difference between method and function in c#?

856