AddItem Method (AComboBox)

Adds an item to the object and returns the zero-based index of the string in the object.

Syntax

[ lAddItem = ] Object.AddItem ( sItem )

The AddItem method syntax has the following parts:

 

Name

Type

Description

Object

AComboBox

AComboBox control

sItem

Val BString

The text string being added.

lAddItem

Long

The return value is the zero-based index of the string in the combo box.

Comments

If an error occurs, the return value is -1 (for example, if there was insufficient space to store the new string).

Example

The following example will add the text string "apples" by value to the AComboBox and will return the index in the string of the added item:

lcb1AddItem1 = cb1.AddItem("apples")

Applies to

AComboBox