Hack Forums
[.NET] Progress Bar - Show progress of result compared to 0 - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Progress Bar - Show progress of result compared to 0 (/showthread.php?tid=5023162)



Progress Bar - Show progress of result compared to 0 - TheDubWubCub - Oct 15, 2015

Hey HF! Not too sure how else to word this, so here we go:

X = 54879
X will be eventually mathematically reduced to 0.

example: (don't worry about the math part, these #'s are just for demonstration)

54879 - %?
math
53403 - %?
math
48392 - %?
math
25832 - %?
math
823 - %?
math
20 - %?
math
0 - 100%

How can I show the progress towards 0 via a progress bar?

Thank you very much in advanced!!🎉


* - YaBoii - Oct 15, 2015

548.79 is one percent (1%) so just divide the number you have by 548.79, optionally round it, and then you have the percentage.


* - 6e756c6c - Oct 15, 2015

This is actually way easier than you probably expected, you're just over thinking it.

Calculate the progress as normal (as if you were counting up to the max value):

Code
Dim Maximum As Integer = 54879
Dim Value As Integer = 15000

Dim Progress As Double = Value / Maximum * 100

Then, once you have the Progress, simply subtract it from 100.

Code
Dim NewProgress As Double = 100 - Progress 'Returns 72.66%



* - TheDubWubCub - Oct 15, 2015

(Oct 15, 2015 11:48 AM)Aeonhack Wrote:  This is actually way easier than you probably expected, you're just over thinking it.

Calculate the progress as normal (as if you were counting up to the max value):

Code
Dim Maximum As Integer = 54879
Dim Value As Integer = 15000

Dim Progress As Double = Value / Maximum * 100

Then, once you have the Progress, simply subtract it from 100.

Code
Dim NewProgress As Double = 100 - Progress 'Returns 72.66%

Thank you very much for your response!
I guess I was overthinking it haha, not sure why my I'm a bit brain-dead today. 😝
Anyways, thanks again & have an awesome day! 👍