AddItem

This method adds an item to a ListBox or ComboBox control or adds a row to a Grid control.

Syntax

control.AddItem item, [index]

Parameters

control
Required. Object expression that evaluates to an ListBox, ComboBox, or Grid control. This method also applies to a CommandBarComboBox object.
item
Required. String expression that specifies the item to add to the object. For the Grid control only, use the tab character—character code 09—to separate multiple strings that you want to insert into each column of a new row.
index
Optional. Integer that specifies 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.

Return Value

None.

Remarks

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