How do i stop the name from repeating itself at 10,000 times.. Right now it repeats every 5 seconds.. but in 24hrs, it should only repeat a maximum of 10,000 times.. How do i stop the timer at a given time?
The program —:
class Timer1
{
public System.Timers.Timer aTimer;
public static void Main()
{
System.Timers.Timer aTimer;
aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.Interval = 5000;
aTimer.Enabled = true;
Console.WriteLine("Press Enter to Exit the Program");
Console.ReadLine();
}
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Console.WriteLine("Name YaP {0}", e.SignalTime);
}
}
I hope this helps you with your answer always glad to help!
Visit the link below for more help.
//http://msdn.microsoft.com/en-us/library/system.timers.elapsedeventargs.signaltime.aspx