C# - Value of '10000' is not valid for 

2019-05-30 07:41发布

I have a web browser progressbar. And the code is:

   private void progressBar1_Click(object sender, WebBrowserProgressChangedEventArgs e)
    {
        progressBar1.Value = unchecked((int)e.CurrentProgress);
    }

And when I play the app. Its gives an error:

Value of '10000' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.

so is there any way to fix it.

3条回答
Animai°情兽
2楼-- · 2019-05-30 08:26

Either provide a value for the current progress that is between the min and max you specified when you created the progress bar (it will be 0 - 100 by default if you didn't specify them) or change the min/max to be what is actually expected of the values you are currently passing.

查看更多
趁早两清
3楼-- · 2019-05-30 08:44

You need to ensure that Value is between Minimum and Maximum. Therefore when you set up your progress bar ensure that you give it an adequate range.

查看更多
戒情不戒烟
4楼-- · 2019-05-30 08:48

ProgressBars normally have a Minimum and Maximum that needs to be set first.

These properties are what tells the control how far the draw progress should be drawn. Value 50 in 1-100 range would tell it that it wanted to draw the progress 50%.

http://msdn.microsoft.com/en-us/library/system.windows.forms.progressbar.maximum.aspx

查看更多
登录 后发表回答