ScrollBars in ASP.NET using VB.NET
In this article we demonstrate on what is Windows ScrollBar control,their properties and how you can use ScrollBars.
A visual basic windows form Scrollbar control used to provide easy navigation through a long list of items or a large amount of information by scrolling either horizontally or vertically within an application or control. Both controls add the scrolling functionality to the controls that do not have in built scrolling such as Container control. The scroll bar control used the scroll Event to monitor the movement of the ScrollBox along the ScrollBar. Using the Scroll Event Provide access to the ScrollBar value as it is being dragged.
Properties of Scrollbars:-
Value:- The value property is an integer value corresponding to the position of the ScrollBox in the ScrollBar.
LargeChange and SmallChange:- The value property changes according to the value set in the LargeChange and smallchange property.
Name :- Name property represents the unique name of the scrollbar controls.
Here we are giving an example in which something strange with scrollbars. That is if you set the minimum, maximum and LargeChange propoerty to some value. In this example vertical and horizontal Scrollbars are set with minimum=1, maximum=7 and LargeChange=2. This will allow the user to select the values between 1 and 5. When you run the program you can click and drag to select values from between 1 to 5. Whenever you release the mouse, however the ScrollBar jumps to 6. If you click the scrollbars arrow or thumb areas. You can also select values from between 1 to 6.
How to do:-
- simply open a new project
- Drag the HScrollBar and VScrollBar and Label control on form. Form will looks like below
- Write the below code.
Private Sub HScrollBar1_Scroll() Handles _
lblHbar.Text = HScrollBar1.Value
Private Sub VScrollBar1_Scroll() Handles _
lblVbar.Text = VScrollBar1.Value