SetTop

Description

Scrolls a list box control so that the specified item is the first visible item.

Applies to

ListBox and PictureListBox controls

Syntax

listboxname.SetTop ( index )

Argument

Description

listboxname

The name of the ListBox or PictureListBox that you want to scroll

index

The number of the item you want to become the first visible item

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is null, SetTop returns null.

Examples

Example 1

This statement scrolls item 6 in lb_Actions to the top of the ListBox so that it is the first visible item:

lb_Actions.SetTop(6)

Example 2

The following statement scrolls the currently selected item in lb_Actions to the top of the list of items:

lb_Actions.SetTop(lb_Actions.SelectedIndex())

See also