Why does this C# timer not fire? (Interval set based on current and picked time) -
i trying set tick alert timer based on time set datetime picker. dont tick alert @ all.
if (datetimepicker1.value >= datetime.now) { sendorder.interval =(int) (datetimepicker1.value.ticks-datetime.now.ticks); sendorder.enabled = true; }
in above code, set tick time based on difference between time datetimepicker - current time. doing wrong on one?
assuming using system.timers.timer
, interval in milliseconds, whereas specifying ticks. there 10,000 ticks in 1 millisecond.
try instead:
sendorder.interval = (int)(datetimepicker1.value.ticks - datetime.now.ticks) / 10000;
Comments
Post a Comment