FindItem Method (AListBox)

Returns the nearest index of an item in the object that has text starting with the specified sItem.

Syntax

[ lFindItem = ] Object.FindItem ( lStartIndex, sItem )

The FindItem method syntax has the following parts:

 

Name

Type

Description

Object

AListBox

AListBox control

lStartIndex

Val Long

Returns or sets the zero-based index of the item before the first item to be searched.

sItem

Val BString

The text string being searched.

lFindItem

Long

The return value is the zero-based index of the matching item in the list box.

Comments

If the return value is -1, the search was unsuccessful. When the search reaches the bottom of the list, it continues from the top of the list box back to the item specified by the parameter. If lStartIndex is -1, the entire list box is searched from the beginning.

The search is case independent.

Example

The following example will find the text string "oranges" by value in the entire AListBox and will return the index in the string, if found:

lIndex=lb1.FindItem(-1, "oranges")

Applies to

AListBox

See Also

AddItem, FindItem, RemoveItem, Sorted