Aracılığıyla paylaş


HScrollBar Control for Visual Basic 6.0 Users

The HScrollBar control in Visual Basic 6.0 is replaced by the Windows Forms HScrollBar 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 an HScrollBar control is changed, the Change event is raised.

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

Value Property

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

When the Scroll or ValueChanged 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 setting in 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 is 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 functionality, Help support, and more.

HScrollBar 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. Those properties, methods, and events that have the same name and behavior 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.

Necessary links are provided to explain behavior differences. Where there is no direct equivalent in Visual Basic 2008, links are provided to topics that present alternatives.

HScrollBar 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, Size

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 was 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 was 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 the Minimum property can not be set to a value greater than the Maximum property.

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 method

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.

HScrollBar 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

HScrollBar 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 Change or Scroll event handlers for the HScrollBar or VScrollBar controls 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)