I'm creating a simple FTP client and i want this certain label to say "List refershed" after a certain action and then after 2 seconds i want the label to say "STATUS". How can i do this?

Recommended Answers

All 5 Replies

Thanks. Gonna take a look.

Thread.sleep is a bad thing to do

. I would try doing another approach.
What it does is it freezes you entire main thread in your program for the length of the durration, and sometimes can result in errors when executing certain processes before or after the thread wait.

Then there's always the option to set a timer for the given interval and do the processing when it expires. But using Thread.Sleep for a small interval like 2 seconds is not unwarranted.

What it does is it freezes you entire main thread in your program for the length of the durration

No, it causes the current thread to go to sleep for the specified duration. The logical next step is to use a separate thread for your UI (or a BackgroundWorker), if you need to perform work while also signaling updates to the UI. Oddly enough, minimal research into Thread.Sleep and the problem of UI updates will produce exactly that information. So strange... :rolleyes:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.