FindItem Method (AComboBox)

Returns the nearest index of an item in the AComboBox control 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

AComboBox

A ComboBox control

lStartIndex

Val Long

Returns or sets the zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list, it continues from the top of the combo box back to the item specified by the parameter. If lStartIndex is -1, the entire combo box is searched from the beginning.

sItem

Val BString

The text string being searched.

lFindItem

Long

The return value is the zero-based index of the matching item in the combo box. If the return value is -1, the search was unsuccessful.

Comments

The search is case independent.

Example

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

lcb1StartIndex = cb1.FindItem(-1, "oranges")

Applies to

AComboBox

See Also

AddItem, Clear, InsertItem, ListCount, RemoveItem