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

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -