I would like to have an event triggered in my app which runs continuously during the day at a certain time, say at 4:00pm. I thought about running the timer every second and
I did this way to fire 7am every morning
bool _ran = false; //initial setting at start up private void timer_Tick(object sender, EventArgs e) { if (DateTime.Now.Hour == 7 && _ran==false) { _ran = true; Do_Something(); } if(DateTime.Now.Hour != 7 && _ran == true) { _ran = false; } }