List
Applies to
VACombo, VAList
Description
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 VAList and VACombo controls through the property browser if the controls are operating in field-bound mode; read-only at run time if the controls are operating in record list mode.
Syntax
object.List(index) [= string]
The List property syntax has these parts:
 
Remarks
Use this property to access list items. If empty, the index is -1. The first item in a list is 0 and the index of the last item is ListCount -1.
Initially, combo box and list box controls contain an empty list. For controls operating in record list mode (VARecordList property set True), 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. Enumerating a list from 0 to ListCount -1 returns all items in the list.
To specify items you want to display in a field-bound (VARecordList property False) VACombo or VAList 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.
Using an Option Base = 1 statement in the Declarations section doesn’t affect the enumeration of elements in Visual Basic controls. The first element is always 0.
When the List index is outside the range of actual entries in the list box, a zero-length string (" ") is returned.
Example
'get the text of the most-recently-added list item
Text1.Text = VAList1.List(VAList1.ListIndex)