I have a winForm c#,and I have a function for sending sms
i want to know how can i call it, run it at specific time
please help me.
Calling function at specific time c#
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Hemant SrivastavaRank #581 · 4.2K reputationPosted Oct 28, 2013, 12:47 PM EDT
In the following way, you can create a timer, set the specific time interval and start the timer in FormLoad() method.
-------------------------------------------------------------------
Timer _tmr = new Timer();
_tmr.Interval = 5000; // interval in millisecond
_tmr.Tick += new EventHandler(tmr_Tick);
_tmr.Start();
--------------------------------------------------------------------
// This is the event handler for the timer
void tmr_Tick(object sender, EventArgs e)
{
// Here, call the SMS Sending method
}
Hope it will help.
VulpesRank #55 · 29.2K reputationPosted Oct 28, 2013, 12:57 PM EDT
DateTime now = DateTime.Now;
DateTime specific = DateTime.Today.AddHours(12); // for 12.00 noon say today
int ms = (int)(specific - now).TotalMilliseconds;
_tmr.Interval = ms;