Reputation: 11
Does monthCalendar gets updated automatically at midnight in C#?
Basically, I am using monthCalendar's DateChanged event, so when I click on a new date in the calendar I get an event happening, but when I had the software open for 48 hours, the calendar didn't update itself automatically and therefore the event didn't work!
Any thoughts would be appreciated.
Jo
Upvotes: 1
Views: 564
Reputation: 7694
DateChanged
event occurs when you manually change the date. It won't automatically occur.
You should use something else.
If you want to know the date has changed I have one basic method.
You grab the date of the program start running with DateTime.Now
and run a timer every 1 hour or so and whenever the timer is hit, check the date again and compare them. If they are not the same, the day has changed.
Upvotes: 2