AddItem Method

Applies To   See Also

Adds a new item to a ComboBox or ListBox control, optionally allowing you to specify the item's index.

Syntax

Control.AddItem(cItem [, nIndex] [, nColumn])

Arguments

cItem

Specifies the string expression to add to the control.

nIndex

Specifies the position where the item is placed in the control. If you supply a valid value for the optional nIndex, cItem is placed at that position within the control. If you specify an nIndex that already exists, the item is inserted at that position and all items below that item are moved down one position in the list portion of the ComboBox or ListBox control.

If you omit nIndex and the Sorted property is set to true (.T.), cItem is added in alphabetic sort order. If you omit nIndex and the Sorted property is set to false (.F.), cItem is added to the end of the list portion of the ComboBox or ListBox control.

nColumn

Specifies the column of the control to which the new item is added. The default is 1.

Remarks

Use the AddItem method or AddListItem method when the RowSourceType property is set to 0 (None).

Each item added to a ComboBox or ListBox has two identification numbers assigned to it: