VB6 Tutorial 43: Scrollbars

Posted On 2018-04-27 by VB6Boy
Keywords:
Tags: VB6 Tutorials 
Views: 59

Title Uploaded Size
scrollbar.zip 4/27/2018 3:30:01 PM 1,140


Looking for the more of the VB6 Tutorial? Here is the tutorial index.

In this lesson, you'll learn the basics of how to work with a scrollbar.

You have seen scroll bars in most of the Windows applications. A scroll bar is a very important element of a software. When you'll work on a software project in VB6, you'll need these controls if you have to scroll down or scroll up a page.

The scrollbar actually comes in two flavors or styles: vertical or horizontal. Both styles have the same properties and events. The only difference is the appearance of each on the screen.

All items discussed here apply to both styles of scrollbar.

Useful properties

The main properties of both the scroll bars are Min, Max, SmallChange, LargeChange and Value.

Vertical scroll bar

Here is the anatomy of a typical scroll bar:

Anatomy of a toolbar

Properties

There are five basic properties that you will likely work with the most. We'll touch on each of them here.

Value

The Value property returns the scroll bar position's value. Each position of the thumb has a value. The Value changes when you click on one of the arrow buttons or when you move the thumb by dragging it.

Min

The Min property sets/returns the minimum value of a scroll bar position.

Max

The Max property sets/returns the maximum value of a scroll bar position.

SmallChange

The SmallChange property sets/returns the amount of change to Value property in a scroll bar when the user clicks on a scroll arrow button./

LargeChange

The LargeChange property sets/returns the amount of change to Value property in a scroll bar when the user clicks on the scroll bar area.

Change Event

Not a property, the Change event fires when an arrow button or the scroll bar area is clicked or after the thumb has been dragged. The Scroll event is raised when the thumb is being dragged.

There is an example project attached to this lesson, a simple length converter for inches and centimeters. Check it out.

Challenge

Using the example project, see if you can add other units of measurement, such as gallons to liters, or perhaps miles to kilometers.

QuickHint:

In some cases, you do not need to use scroll bars as many controls in VB6 provide a scroll bar with them. For example, the TextBox control has a scroll bar with it, and it becomes enabled when you set the Multi-Line property of the TextBox control to True.

Looking for the more of the VB6 Tutorial? Here is the tutorial index.


About the Author

has posted a total of 78 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.166.212.152

Before you can post, you need to prove you are human. If you log in, this test goes away.


Code Links