Delen via


VScrollBar Control for Visual Basic 6.0 Users

The VScrollBar control in Visual Basic 6.0 was replaced by the Windows Forms VScrollBar control in Visual Basic 2008. The names of some properties, methods, events, and constants are different, and in some cases there are differences in behavior.

Conceptual Differences

Change Event

In Visual Basic 6.0, when the Value property of a VScrollBar control is changed, the Change event is raised.

In Visual Basic 2008, the Change event is not raised; instead, the ValueChanged event is raised.

Value Property

In Visual Basic 6.0, when the Scroll or Change event of a VScrollBar control is raised, the current scroll value is assigned to the Value property.

When the Scroll event is raised in Visual Basic 2008, the control's Value property has not yet been updated. If you need to emulate Visual Basic 6.0 behavior, you can create a helper function to retrieve the value. For more information, see Code was changed from an event to a procedure.

LargeChange Property

In Visual Basic 6.0, the LargeChange property determines the amount of change to the Value property of a scroll bar control when the user clicks the area between the scroll box and scroll arrow.

In Visual Basic 2008, the default value of the LargeChange property is 10; in Visual Basic 6.0 it is 1.

Max Property

In Visual Basic 6.0, the Max property determines the maximum Value property setting in a scroll bar control.

In Visual Basic 2008, the Max property is replaced by the Maximum property; the default value is 100, in Visual Basic 6.0 it was 32767.

Min Property

In Visual Basic 6.0, the Min property determines the minimum Value property setting in a scroll bar control. The Min property can be set to a value greater than that of the Max property.

In Visual Basic 2008, the Min property is replaced by the Minimum property, the value of which must always be less than that of the Maximum property.

Other Differences

In addition, there are numerous conceptual differences that apply to all controls, including differences in data binding, font handling, drag and drop, Help support, and more. For more information, see Windows Forms Concepts for Visual Basic 6.0 Users.

VScrollBar Control Property, Method, and Event Equivalencies

The following tables list Visual Basic 6.0 properties, methods, and events, along with their Visual Basic 2008 equivalents. Properties, methods, and events with the same names and behaviors are not listed. Where applicable, constants are indented beneath the property or method. All Visual Basic 2008 enumerations map to the System.Windows.Forms namespace unless otherwise noted.

Links are provided as necessary to topics explaining differences in behavior. Where there is no direct equivalent in Visual Basic 2008, links are provided to topics that present alternatives.

Properties

Visual Basic 6.0

Visual Basic 2008 Equivalent

Container

Parent

DragIcon

DragMode

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

Height

Height

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

HelpContextID

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

HWnd

Handle

Index

New implementation. For more information, see Control Arrays for Visual Basic 6.0 Users.

LargeChange

LargeChange

NoteNote:
The default value in Visual Basic 6.0 is 1; in Visual Basic 2008 the default value is 10.

Left

Left

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

Max

Maximum

NoteNote:
The default value in Visual Basic 6.0 is 32767; in Visual Basic 2008, the default value is 100.

Min

Minimum

NoteNote:
In Visual Basic 6.0, Min can be set to a value greater than Max; in Visual Basic 2008, this is not allowed.

MouseIcon

New implementation. For more information, see Cannot set a custom MousePointer.

MousePointer

Cursor

For a list of constants, see MousePointer for Visual Basic 6.0 Users.

Parent

FindForm

RightToLeft:

True

False

RightToLeft

 Yes enumeration value

 No enumeration value

Top

Top

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

Value

Value

NoteNote:
In Visual Basic 6.0, when the Value is changed, the Change event is raised. In Visual Basic 2008, the Change event is not raised; use the ValueChanged event instead.

WhatsThisHelpID

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

Width

Width, Size

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

Methods

Visual Basic 6.0

Visual Basic 2008 Equivalent

Drag

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

Move

SetBounds

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

SetFocus

Focus

ShowWhatsThis

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

ZOrder:

 0 – vbBringToFront

 1 - vbSendToBack

BringToFront or SendToBack function

 BringToFront

 SendToBack

Events

Visual Basic 6.0

Visual Basic 2008 Equivalent

Change

ValueChanged

NoteNote:
The behavior of the Change and Scroll events have changed in Visual Basic 2008. For more information, see Code was changed from an event to a procedure.

DragDrop

DragOver

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

GotFocus

Enter

LostFocus

Leave

Scroll

Scroll

NoteNote:
The behavior of the Change and Scroll events have changed in Visual Basic 2008. For more information, see Code was changed from an event to a procedure.

Validate

Validating

Upgrade Notes

When a Visual Basic 6.0 application is upgraded to Visual Basic 2008, any code in the Scroll event handler for the HScrollBar or VScrollBar control is changed to a procedure due to a difference in the sequence of events. For more information, see Code was changed from an event to a procedure.

See Also

Reference

HScrollBar and VScrollBar Controls Overview (Windows Forms)