How can I execute some code, once a day.
e.g. call MyMethod() at 3pm every day.
(provided the app is running of course)…
Im trying to do this in c# winforms.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you simply want to run something at the same time every day, you can use the built in task scheduler.
You can setup a daily schedule that will execute your application at the same time every day.
Otherwise, in your application you will need to setup a timer and check in the tick event if the current time is 3pm and only call your method at that point.
I would have suggested a windows service, but as you stated that you only need the method to run if the application is already running, this is not needed.