Visual Basic Reference
- Max returns or sets a scroll bar position's maximum Value property setting when the scroll box is in its bottom or rightmost position. For the ProgressBar control, it returns or sets its maximum value.
- Min returns or sets a scroll bar position's minimum Value property setting when the scroll box is in its top or leftmost position. For the ProgressBar control, it returns or sets its minimum value.
object.Max [= value]
object.Min [= value]
The Max and Min property syntaxes have these parts:
|object||An object expression that evaluates to an object in the Applies To list.|
|value||A numeric expression specifying the maximum or minimum Value property setting, as described in Settings.|
For each property, you can specify an integer between -32,768 and 32,767, inclusive. The default settings are:
- Max 32,767.
- Min 0.
The Microsoft Windows operating environment automatically sets ranges for scroll bars proportional to the contents of forms, ComboBox controls, and ListBox controls. For a scroll bar (HScrollBar or VScrollBar) control, however, you must specify these ranges. Use Max and Min to set a range appropriate to how the scroll bar control is used for example, as an input device or as an indicator of speed or quantity.
Typically, you set Max and Min at design time. You can also set them in code at run time if the scrolling range must change dynamically for example, when adding records to a database that can be scrolled through. You set the maximum and minimum scrolling increments for a scroll bar control with the LargeChange and SmallChange properties.
Note If Max is set to less than Min, the maximum value is set at the leftmost or topmost position of a horizontal or vertical scroll bar, respectively. The Max property of a ProgressBar control must always be greater than its Min property, and its Min property must always be greater than or equal to 0.
The Max and Min properties define the range of the control. The ProgressBar controls Min property is 0 and its Max property is 100 by default, representing the percentage duration of the operation.