Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
List Property Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
[form.]ctlname.List(index%)[ = stringexpression$]
Usage Notes
■ For all list box controls (except a directory list box), 0 is the index
of the first item and ListCount-1 is the index of the last item.
Enumerating a list from 0 to ListCount-1 returns all items in the list.
■ For a directory list box, enumerating the list from -n to ListCount-1
returns a list containing all directories and subdirectories visible
from the currently expanded directory. In this case, n is the number of
directory levels above the currently expanded directory.
■ The index number sequence for a directory list box is based on the
directories and subdirectories present when the control is created at
run time:
Index Description
═════════════════ ═══════════════════════════════════════════════════
-1 The currently expanded directory.
-2 to -n Directories above the currently expanded directory;
represented by a negative index with higher absolute
values. For example, -2 is the parent directory of
the currently expanded directory, and -3 is the
directory above that.
0 to ListCount-1 Directories below the currently expanded directory.
───────────────────────────────────────────────────────────────────────
See: ◄Directory List Box Control►
■ Initially, combo boxes and list boxes contain an empty list.
See: ◄Combo Box Control► ◄List Box Control►
■ When the List index is outside the range of actual entries in the list
box, an empty string is returned. For example, List(-1) returns an
empty string for a combo box or list box.
■ The contents of the initial list for file-system controls are
determined by conditions that exist when the control is created at run
time:
Control Description
══════════════════ ══════════════════════════════════════════════════
Directory list box Contains a list of all directories, using the
range -n to ListCount-1
Drive list box Contains the list of drive connections in effect
File list box Contains the list of files in the currently
expanded directory that match the Pattern
property; the path is not included
───────────────────────────────────────────────────────────────────────
See: ◄Directory List Box Control► ◄Drive List Box Control►
◄File List Box Control► ◄Pattern Property►
■ Use the ADDITEM method to specify items you want to display in a combo
box or list box, often as part of the container form's Load event
procedure. To keep items in alphabetical order, set the control's Sorted
property to True (-1) before adding items to the list. To remove items,
use the REMOVEITEM method.
See: ◄ADDITEM Method► ◄Load Event►
◄REMOVEITEM Method► ◄Sorted Property►