Progress Bar.

Michaelk

Well-known member
Joined
Jun 3, 2004
Messages
58
Location
Australia
Programming Experience
3-5
Hi, i was wondering how i could like a Progress bar to the status of a download.
In my app i've got an auto-update from the web option, where the user can download and install the update through my app. Currently i've got a progress bar based on a set time, but that works on my internet connection. If the user has a slower connection, the timer may complete before the download has finished.
Does anyone know how i'm able to link the download status and the progress bar so that progress bar displays the ammount downloaded?
Thanks in advance!
 

Schenz

Well-known member
Joined
Sep 11, 2004
Messages
181
Location
Cincinnati, OH
Programming Experience
5-10
I have not done anything like this before, so this answer is using some assumptions I do not know are valid.

1. You get the Size of the file to be downloaded.
2. You track how much of that file has been downloaded, and use division to get a percentage and update the progress bar accordingly.

This assumes you have, or can get the full file size, and that you can get the amount of that size currently downloaded.
 

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,461
Programming Experience
10+
Michaelk said:
Hi, i was wondering how i could like a Progress bar to the status of a download.
In my app i've got an auto-update from the web option, where the user can download and install the update through my app. Currently i've got a progress bar based on a set time, but that works on my internet connection. If the user has a slower connection, the timer may complete before the download has finished.
Does anyone know how i'm able to link the download status and the progress bar so that progress bar displays the ammount downloaded?
Thanks in advance!
If you're not opposed to third party components, I use the HTTP control in IP*Works by /n software. It will provide events such as you require to determine progress.

You may want to search The Code Project for sample code (or google, my favorite developer companion! :)) on downloads in .NET. It's mostly a C# site, but you should be able to convert the sample code to VB.NET easily.
 

Michaelk

Well-known member
Joined
Jun 3, 2004
Messages
58
Location
Australia
Programming Experience
3-5
Ok, i sat down and used the examples. It's exactly what i was after!
I've managed to get a percentage of how far the download has completed, how am i able to use this to run the progress bar?
I've tried TextChanged event, so that each time the number raises it raises the progress bar, but that didn't work. I've tried to tie it in with the download scripts, but that didn't work either.
I'm sure there is a really simple way, i just can't seem to find it.
Thanks.
 
Top Bottom