I have a sign in system running at my school, and when a student signs in, it shows a welcome message and after 5 seconds, this welcome message is erased to be replaced by, “Please swipe your student card”. I have a sleep thread running. I want the welcome label to reset to say “Please swipe your ID card” after the sleep thread has finished, but it won’t do it. Any help? Am I going about this the right way? Thank you.
Share
You haven’t given any details so we need to guess at the exact cause of the problem. I’m going to assume that you are using C# on Windows.
I’d guess that you are trying to perform user interface code from a worker thread which is an error. User interface code should run in the main thread.
Whilst this could be solved with
Control.Invokea much better approach is to avoid any threads, use a timer for your 5 second wait and perform the UI update in the main thread.