robplatt Posted September 13, 2006 Posted September 13, 2006 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? Quote
Administrators PlausiblyDamp Posted September 13, 2006 Administrators Posted September 13, 2006 You might find it easier to download the data in question as a stream (using the .OpenRead method) - this will allow you do download it in chunks and do any relevant status updates in between chunks. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
robplatt Posted September 13, 2006 Author Posted September 13, 2006 I can use that in a for...next huh, ill have to play around with it. if i figure it out ill post it for others. Quote
robplatt Posted September 14, 2006 Author Posted September 14, 2006 (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 September 14, 2006 by robplatt Quote
OMID SOFT Posted September 14, 2006 Posted September 14, 2006 (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 September 14, 2006 by OMID SOFT Quote Don't ask what your country can do for you, ask what you can do for your country...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.