Locked up Download

  • Thread starter Thread starter meoblast001
  • Start date Start date
M

meoblast001

I use the following code

My.Computer.Network.DownloadFile(file.Text, "C:\Program Files\Mystic Galaxies\

Mystic Galaxies Aqua\Downloads\" & title.Text & ".mp3")

and it downloads the file, but freezes the application. Why is it doing this?
 
meoblast001 said:
I use the following code

My.Computer.Network.DownloadFile(file.Text, "C:\Program Files\Mystic Galaxies\

Mystic Galaxies Aqua\Downloads\" & title.Text & ".mp3")

and it downloads the file, but freezes the application. Why is it doing this?

You're doing the download in the UI thread. You should use a background
worker thread to do the download. Note that you won't be able to access
the Text property of your textfields within that thread.

See http://pobox.com/~skeet/csharp/threads/winforms.shtml for more
info.
 
Back
Top