InsertItem Method (AComboBox)

Inserts an item on the object at a specified position.

Syntax

[ lInsertItem = ] Object.InsertItem ( lIndex, sItem )

The InsertItem method syntax has the following parts:

 

Name

Type

Description

Object

AComboBox

AComboBox control

lIndex

Val Long

Insert an item on the control at a position specified by lIndex.

sItem

Val BString

The text string being inserted.

lInsertItem

Long

The inserted item.

Comments

If lIndex is -1, then the item is appended to the end of the list. The return value is the zero-based index of the string in the list box. If an error occurs, the return value is -1, for example, if there is insufficient space to store the new string.

Example

The following example will insert the text string "grapes" by value to the AComboBox before the current 6th item:

cb1.AddItem(5)="grapes"

Applies to

AComboBox

See Also

AddItem, Clear, FindItem, ListCount, RemoveItem