How to Use ScrollBar in VB6

Written by lora covrett
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Use ScrollBar in VB6
The ScrollBar is located to the right of your web browser and allows you to move up and down the page of this article. (Jupiterimages/Comstock/Getty Images)

The ScrollBar allows you to scroll up and down the page of your web browser. That is a vertical ScrollBar. Visual Basic has vertical and horizontal ScrollBars. The controls are located in the Toolbox and are named "HScrollBar" and "VScrollBar." In addition, some VB controls also have built-in scrolling abilities such as the ComboBox, ListBox, TreeView and ListView controls. A bit of extra coding is required to use the separate scroll bars to provide scrolling to other controls such as a PictureBox, Frame or the Form itself.

Skill level:
Moderate

Other People Are Reading

Instructions

  1. 1

    Create a new Standard EXE Visual Basic project. Select the Label control and add it to the form, named "Form1" by default. The default name for the Label is "Label1."

  2. 2

    Select VScrollBar from the VB Toolbox and add it to the form to the right of "Label1." Resize it till the top of "VScroll1" is at the top of "Label1" and the bottom of each control lines up as well.

  3. 3

    Set the Max, Min and LargeChange properties for "VScroll1." Set the Min to 1 and the Max to 10. The LargeChange number is how much the ScrollBar should move when the user clicks the ScrollBar area. When the user clicks the down or up arrows, the ScrollBar moves by the "Value" property amount. Set LargeChange to 2 and Value to 1.

  4. 4

    Change the value of "Label1" each time "VScroll1" is clicked by coding "Label1.Caption = VScroll1.Value" in the "VScroll1_Change" event.

  5. 5

    Use the "Move" method of "Label1" to actually move up and down within the Label control each time "VScroll1" is clicked. To move down, subtract from the "Top" property of "Label1." This code should also be placed within the "VScroll1_Change" event.

Tips and warnings

  • Edit the Min, Max and LargeChange values of the ScrollBar control to suite the needs of your specific application.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.