Reputation: 1710
Small question:
How do i call a function on a specific time in C#?
I want to call a function at 11:00 PM that will call a database export to a certain server.
Upvotes: 1
Views: 1812
Reputation: 557
You can use Quartz.net to schedule your call method, it give lot of possibilities for scheduling your task and also i think it's simple to use it, here is link for tuorial: www.quartz-scheduler.net/
Upvotes: 1
Reputation: 83
You can use windows service to schedule a program to trigger on certain time intervals..
Here is an article that exactly matches to your requirement..
http://www.codeproject.com/Tips/350635/Scheduling-Window-Service-Daily-Weekly-Monthly
Upvotes: 0
Reputation: 1389
In your window form add the control timer, then giving double click on it, insert the function that you want to run, on the property of the timer must indicate the execution time in milliseconds.
private void timer1_Tick (object sender, EventArgs e)
{
timer1.Start ();
/ / Function name ();
timer1.Stop ();
}
For more infromation see this link :
How to call a method daily, at specific time, in C#?
Upvotes: 0
Reputation: 2448
You can use Quartz.NET, its an awesome library for scheduling, but you need host running (windows service, running exe,.. .)
If you don't want running host, you could also refactor and wrap you function call into a library and then invoke that library from powershell script, you can use Windows' Task Scheduler for setting "basic task" at 11AM.
You can also refactor your application in a way you could directly call this app from Windows' Task Scheduler
Upvotes: 2
Reputation: 6490
Well either use the windows integrated Task planning to start your program at certain times or use an existing cron-like implementation for C# like Quartz.net
Upvotes: 1