TopIndex Property and Scroll Event for Visual Basic 6.0 Users

Visual Basic 2008 no longer supports the TopIndex property for a ComboBox control or the Scroll event for ListBox or ComboBox controls.

Conceptual Differences

TopIndex Property

In Visual Basic 6.0, the TopIndex property is used to return or set a value that specifies which item in a ComboBox or ListBox control displayed in the topmost position. This property is commonly used to scroll the list without selecting an item.

In Visual Basic 2008, the ComboBox control no longer supports the TopIndex property. In most cases this should not present a problem as setting the TopIndex property has no visible effect, unless the Style property is set to 1 - SimpleCombo. In this case, you can emulate the ComboBox's SimpleCombo behavior by using a ListBox control and a TextBox control, as the ListBox control still supports the TopIndex property.

Scroll Event

The Scroll event in Visual Basic 6.0 is used in conjunction with the TopIndex property to perform actions when the list is scrolled. Visual Basic 2008 does not support the Scroll event; however, in most cases the SelectedIndexChanged event should be a suitable replacement.

Upgrade Notes

When a Visual Basic 6.0 application is upgraded to Visual Basic 2008, any code that references the TopIndex property for a ComboBox control or any code in the Scroll event procedure for a ComboBox or ListBox control is not upgraded. The Upgrade wizard inserts a warning comment in the code; the code must be removed for the application to compile.

See Also

Concepts

ComboBox Control for Visual Basic 6.0 Users

ListBox Control for Visual Basic 6.0 Users

Reference

SelectedIndexChanged

SelectedIndexChanged