Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I know (and have the code) to use webclient async to start a file download, then put code in the progress function to watch the status. Works fine, but its more like a background thread while the rest of your app continues to run...

 

However, I need or would like the abililty to do the same thing only not async. In other words I want to start a download, watch the progress bar and then move on to the next lines of code.

 

I suppose I could watch for when the download finished and then have my code there, but im downloading a few things. and i dont want to have to put it in a seperate form. I would like to:

 

1; download file a

2; watch progress

3; process file a

4; download file b

5; process file b

6; finish.

 

any ideas? anyone else do something similar?

Posted (edited)

PlausibyDump... I am ashamed at you :p Your an expert you should have suggested the most obvious :D didnt dawn on me until just now, so i hang my head low. some programmer i am.

 

This works exactly as i wanted it:

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       Me.Show()
       WebClient.DownloadStringAsync(New Uri("www.whatever"))
       While WebClient.IsBusy
           Application.DoEvents()
       End While

   End Sub

   Private Sub webClient_DownloadProgressChanged(ByVal sender As System.Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles WebClient.DownloadProgressChanged
       ProgressBar1.Value = e.ProgressPercentage
   End Sub

 

 

But I do thank you for your response. I learned a few things on my quest for this answer.

Edited by robplatt
Posted (edited)
PlausibyDump... I am ashamed at you :p Your an expert you should have suggested the most obvious :D

 

No one knows everything, also please split the long lines in your post.

Edited by OMID SOFT
Don't ask what your country can do for you, ask what you can do for your country...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...