Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello, i want to know what is wrong with my code. the progress bar wont work at all. it shows an error.
"Value of '10000' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.
Parameter name: Value"

how to make this work?
here is my code for progress bar
C#
if (e.CurrentProgress > 0)
                {
                    progressBar1.Value = Convert.ToInt32(e.CurrentProgress);
                    progressBar1.Maximum = Convert.ToInt32(e.MaximumProgress);
                    progressBar1.Minimum = (0);
                  
                }
                else
                    progressBar1.Value = Convert.ToInt32(0);
Posted

1 solution

What's with all the Converts?

Without knowing the values of your e.CurrentProgress and e.MaximumProgress, it's ahrd to be specific.

But, you'd normally set the Minimum and Maximum value properties of the ProgressBar control before you start the operation that you're monitoring for progress.

Then you won't get this error message when you set the Value property, provided it's between the two Minimum and Maximum values that have already been set.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900