Visual Basic Reference

AddItem Method

See Also    Example    Applies To

Adds an item to a ListBox or ComboBox control or adds a row to a MS Flex Grid control. Doesn't support named arguments.

Syntax

object**.AddItem**item, index

The AddItem method syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
item Required. string expression specifying the item to add to the object. For the MS Flex Grid control only, use the tab character (character code 09) to separate multiple strings you want to insert into each column of a newly added row.
index Optional. Integer specifying the position within the object where the new item or row is placed. For the first item in a ListBox or ComboBox control or for the first row in a MS Flex Grid control, index is 0.

Remarks

If you supply a valid value for index, item is placed at that position within the object. If index is omitted, item is added at the proper sorted position (if the Sorted property is set to True) or to the end of the list (if Sorted is set to False).

A ListBox or ComboBox control that is bound to a Data control doesn't support the AddItem method.