0

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?

4
Contributors
5
Replies
25
Views
4 Years
Discussion Span
Last Post by deceptikon
-1

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.

1

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.

Edited by Reverend Jim

-1

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:

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.