List

Returns or sets the items contained in a control's list portion. The list is a string array in which each element is a list item. Available at design time for ListBox and ComboBox controls through the property browser; read/write at run time for ComboBox and ListBox controls.

Syntax

object.List(index) [= string]

The parts of the List property syntax are described in the following table.

Part Description
object An object expression that evaluates to an object.
index The number of a specific item in the list.
string A string expression specifying the list item.

Remarks

Use this property to access list items.

For all controls, the index of the first item is 0 and the index of the last item is ListCount–1.

Initially, ComboBox and ListBox controls contain an empty list. For the file-system controls, the list is based on conditions that exist when the control is created at run time:

The List property works in conjunction with the ListCount and ListIndex properties.

Note To specify items you want to display in a ComboBox or ListBox control, use the AddItem method. To remove items, use the RemoveItem method. To keep items in alphabetic order, set the control's Sorted property to True before adding items to the list.