Hi, i created a small download manager.
I've done everything mostly, but having a small problem at timespan. I was calculating left time remaining for the download to be completed. But i'm having a problem at this point :
double secondsRemaining = ((100 - progressBar.Value) * sw.Elapsed.TotalSeconds / progressBar.Value);
TimeSpan ts = TimeSpan.FromSeconds(secondsRemaining);
What i get is "TimeSpan overflowed because the duration is too long. I've tried so many formulas, but non of them gives me the exact time left. After i edited the formula a lil bit, i found that the problem is caused by the sign "/" divide.
Thank you.
Having a problem at TimeSpan
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Jan 29, 2014, 12:48 PM EST
However, when progress.Value is still zero, secondsRemaining will either by positive infinity or NaN and you will then get the overflow exception when you attempt to convert to a TimeSpan.