I just put a progress bar in my program and was wondering how I could calculate the time that remains like when you download something.
Printable View
I just put a progress bar in my program and was wondering how I could calculate the time that remains like when you download something.
if you know the size of the file you are downloading, then just compare to the amount of file already being downloaded to the size of the original file.
divide the file size by 100
and raise the progress bar's value by 1 everytime Increment amount of the file has been downloaded.Code:Increment = FileSize / 100
Here is a program from http://www.planet-source-code.com which lets you Calculate Internet Download Time.
If you want to find out the estimated time left for a certain action you do on your form, here is an example from PatorJK's site to tell the estimated time left.
TimeLeft=(1-AlreadyDownloaded/FileSize)*Elapsedtime-ElapsedTime