Thanks a lot Pradeep it works! (TimeRemaining = (100- downloaded) * TimeElapsed/downloaded)
Here is what I exactly did:
Where "Time" is just the timer which counts seconds.Code:Private Sub Download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles Download.DownloadProgressChanged Dim FormulaH As Single = ((100 - ProgressBar1.Value) * Time / ProgressBar1.Value) / 3600 Dim FormulaM As Single = ((100 - ProgressBar1.Value) * Time / ProgressBar1.Value) / 60 Dim FormulaS As Single = (100 - ProgressBar1.Value) * Time / ProgressBar1.Value If ProgressBar1.Value = 0 Then Label6.Text = "Time Left: Estimating..." Else If FormulaS > 3599 Then Label6.Text = "Time Left: " & Mid(FormulaH, 1, 2) & " h and " & Mid(FormulaM, 1, 2) & " min" ElseIf FormulaS > 60 And FormulaS < 3600 Then Label6.Text = "Time Left: " & Mid(FormulaM, 1, 2) & " min and " & Mid(FormulaS, 1, 2) & " sec" Else Label6.Text = "Time Left: " & Mid(FormulaS, 1, 2) & " sec" End If End If ProgressBar1.Value = e.ProgressPercentage Label1.Text = e.ProgressPercentage & "%" End Sub
Now... the only little problem is that sometimes the estimate time will state something like:
Time left: "11 min and 65 sec"
How could I fix it with:
"Time left: 12 min and 5 sec" ?
Thanks a lot again!




Reply With Quote
