i am trying to set the tick alert for the timer based on the time set by the datetime picker. however i dont get the tick alert at all.
if (dateTimePicker1.Value >= DateTime.Now)
{
sendOrder.Interval =(int) (dateTimePicker1.Value.Ticks-DateTime.Now.Ticks);
sendOrder.Enabled = true;
}
in the above code, i set the tick time based on difference between time from datetimepicker – current time. what am i doing wrong on this one?
Assuming you are using
System.Timers.Timer, Interval is in milliseconds, whereas you are specifying ticks. There are 10,000 ticks in 1 millisecond.Try this instead: