AddItem

Adds an item to a ListBox or ComboBox control or adds a row to a Grid control. AddItem does not support named arguments.

Syntax

object.AddItem item, index

The parts of the AddItem method syntax are described in the following table.

Part Description
object Required. An object expression that evaluates to an object.
item Required. String expression specifying the item to add to the object. For the 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 Grid control, index is 0. If index is omitted for the Grid control, the new row becomes the last.

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).