Reputation: 426
i can calculate only percentage..
so can you gudie me about time elapsed and time remaining from progressbar value?
this is my code
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
percent = percent + 1
Label1.Text = percent
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 100
If ProgressBar1.Value = 100 Then
Timer1.Stop()
MsgBox("done")
Else
ProgressBar1.Value = percent
show_percent.Text = String.Format("{0:F0}%", ((ProgressBar1.Value / ProgressBar1.Maximum) * 100))
End If
End Sub
Upvotes: 1
Views: 333
Reputation: 54417
You would calculate the elapsed time using a Stopwatch
. Calculating the expected total time and time remaining from that is simple arithmetic. Total time is elapsed time multiplied by maximum divided by the current and the remaining time is the total time less the elapsed time.
Upvotes: 1