Visual Basic Sample Programs: Horizontal & Vertical Scroll-bar Application System

Knoji reviews products and up-and-coming brands we think you'll love. In certain cases, we may receive a commission from brands mentioned in our guides. Learn more.
A scroll bar is typically used to increase or decrease a value such as when we want to change the color setting of our computer?s monitor through the Control Panel?s Display object or to increase or decrease the volume of our computer??

Add another trick to your Visual Basic 6 toolbox by following simple Horizontal and Vertical scroll-bar application systems that demonstrate how a scroll bar works.

Horizontal Scroll Bar

Follow the given procedure below in designing and developing a simple horizontal scroll-bar application system.

Solution

  1. Select and click the Visual Basic under  the Microsoft Visual Studio at the Start of the Taskbar and Programs submenu of the operating system.
  2. Start a new project and select the Standard EXE on the given displayed items, then click the Open command button.  Set the caption of the Form to Horizontal Scroll bar.
  3. Double-click the Horizontal Scroll bar and labels in the Toolbox to add them into the form.  Position them properly at the form.
  4. Set the Max property of HScroll to 100, its Value property to 50 and its LargeChange property to 10.
  5. Click the Font property of Label1 and set the Font Size property to 24 and its Autosize to True.
  6. Double-click the scroll bar to open the Code editor and add the following code:

Private Sub HScroll1_Change ( )

  Label1.Caption = Trim$ (Str$ (HScroll1.Value) )

End Sub

  1. Run the application system by selecting the Run menu at the menu bar and click the Start item (or click the Run icon at the tool bar).

Vertical Scroll Bar

Follow the given procedure below in designing and developing a simple vertical scroll-bar application system.

Solution:

  1. Select and click the Visual Basic under the Microsoft Visual   Studio at the Start of the Taskbar and Programs submenu of the operating system.
  2. Start a new project and select the Standard EXE on the given displayed items, then click the open command button.  Set the caption of the form to Vertical Scroll bar 1.
  3. Double-click the Vertical Scroll bar and Labels in the Toolbox  to add them into the form.  Position them properly at the form.
  4. Set the Max property of Vscroll1 to 100, its Value property to 50 and its LargeChange property to 10.
  5. Click the Font property of Label1 and set the Font Size property to 24 and its Autosize to True.
  6. Double-click the scroll bar to open the Code editor and add the following code:

Private Sub VScroll1_Scroll ( )

   Label1.Caption = Trim$ (Str$ (VScroll1.Value) )

End Sub

Run the application system by selecting the Run menu at the menu bar and click the Start item (or click the Run icon at the toolbar).

Source:

Introduction To Visual Basic 6 by Copernicus P. Pepito; Philippine Copyright 2005, National Book Store Reprint 2008

4 comments

Mark Cruz
0
Posted on Apr 15, 2012
Madhushan Muthukumar
0
Posted on Mar 30, 2012
Donata L.
0
Posted on Mar 29, 2012
Sourav RC
0
Posted on Mar 29, 2012