Lex_The_Great
Lex_The_Great

Reputation: 17

application hangs on while (webClient.IsBusy)

I am creating an updater and it launches/reads files when its done using while like so,

while (webClient.IsBusy) { lbStat.Text = "Downloading: " + file; }

It doesn't display the Downloading: Filehere but it does download. The download has a download bar how fast your downloading etc but will not show up because it hangs on while. Is there anything like while but does not hang?

Upvotes: 0

Views: 1146

Answers (1)

Karthik
Karthik

Reputation: 2399

Thats because you are running a time consuming work on your UI thread if you do that, your UI thread will block/freeze until that task completes.

I have used background worker in such scenarios .Here are few links that may help

http://www.dotnetperls.com/backgroundworker

How to use a BackgroundWorker?

Upvotes: 1

Related Questions