How can I enabled and disabled button in c# by time? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I enabled and disabled button in c# by time?

Example: If 6:00 Am the button will be enabled and if 6:00 Pm the button will be enabled?

13th Jun 2021, 7:07 AM
Khem Olayta
Khem Olayta - avatar
2 Answers
+ 5
Yes. Use a timer for this. https://docs.microsoft.com/en-us/dotnet/api/system.timers.timer?view=net-5.0 Winforms or wpf ? Make sure the timer is not running on the ui-thread.
13th Jun 2021, 7:29 AM
sneeze
sneeze - avatar
+ 2
Oh I see that might be my problem thank you.
13th Jun 2021, 7:31 AM
Khem Olayta
Khem Olayta - avatar