The ScrollBar is a commonly used control, which enables the user to select a value
by positioning it at the desired location. It represents a set of values. The
Min and Max property represents the minimum and maximum value. The value property
of the ScrollBar represents its current value, that may be any integer between
minimum and maximum values assigned.
Following example illustrates the
ScrollBar control
* Open a new Standard EXE project and name the form as
ScrollBar.frm and name the project as ScrollBar.vbp
* When the thumb's position of the ScrollBar is changed
the value has to displayed in the TextBox.
* Design the application as shown below.
| Object |
Property
|
Setting |
| Form |
Caption
Name |
Scroll
Bar
frmScrollbar |
| CommandButton |
Caption
Name |
Exit
cmdExit |
| VScrollBar |
Max
Min
Name
Value |
100
0
vsb1
50 |
| TextBox |
Name
Text |
txtPercentage
% |

The following codes are entered in the vsb1_Change(
) and cmdExit_Click( ) procedures.

Save the project and run the application
by pressing F5 or clicking the Run icon in the ToolBar. We can see the value changes
as soon as you move the thumb's position of the vertical scroll bar.
( Download
the source code)