views:

40

answers:

2

I've set up a simple progress bar in a VB6 form using the Microsoft Common Controls 6.0 component, and everything seems to work correctly.

However, I use the progress bar for several different parts of the form, each of which use different (and variable) maximum values. When I try to change the maximum value at run-time after the bar has already been used once, I get the error Run-time error '380': Invalid Property Value. The progress bar's value is already reset to the minimum before trying to change the max value.

Do these progress bars not allow their max values to be changed after use, or is there some reset method that I'm missing?

prgLoading.Min = 1
prgLoading.Max = positions.Count

The second line throws the error, and the exact same code is used earlier without any problems.

A: 

just set prgloading.value=prgloading.min before setting prgloading.max

Sachin
The OP states "The progress bar's value is already reset to the minimum before trying to change the max value." so it's not ths.
ChrisF
(posting from operamini hence no formating). OP has mentioned that but the code id not reflecting the same
Sachin
I know it's not in the code, but the value IS set.
derekerdmann
@derek: the exception says the value IS set wrong.
Hans Passant
No, the exception is saying that the Max value cannot be set, not that the progress bar's value isn't set.
derekerdmann
+3  A: 

You can still reset the Min and Max properties. Setting Min higher than the Max or vice-versa will cause a 380 error. You should double check your positions.Count value.

Beaner
Ah, nice catch. Turned out positions.Count did go to 0 on a couple occasions. Thanks!
derekerdmann