AddItem, AddListItem, Clear, RemoveItem, RemoveListItem
These methods let you populate and depopulate combo boxes and list boxes whose RowSourceType is set to 0 (for None) or 1 (for Value). The two Add methods add new items to the combo or list. The Remove methods take individual items out of the list. The Clear method removes all items from the list. Understanding the differences between the two pairs of add and remove commands could drive a person to drink. Luckily, Tamar's a teetotaler.
Usage |
oObject.AddItem( cValue [, nIndex [, nColumn ] ] ) oObject.AddListItem( cValue [, nItemId [, nColumn ] ] ) oObject.Clear() oObject.RemoveItem( nIndex ) oObject.RemoveListItem( nItemId ) |
Parameter |
Value |
Meaning |
cValue |
Character |
The text of the item to be added to the list. |
nIndex |
Numeric |
The position in the list of the item to be added or removed. |
nItemId |
Numeric |
The unique identification number of the item to be added or removed. |
nColumn |
Numeric |
The column in which the newly added item is to be placed. |
Example |
* Fill a list box with the names and titles from Employee * This code might be in the Init method of the list box This.ColumnCount = 3 This.ColumnWidths = "75,60,150" LOCAL nRow SELECT Employee nRow=1 && See NewItemId for a better way SCAN This.AddListItem(Last_Name, nRow, 1) This.AddListItem(First_Name, nRow, 2) This.AddListItem(Title, nRow, 3) nRow=nRow+1 ENDSCAN * To see them in alpha order, add This.Sorted=.T. |
See Also |
ComboBox, List Property, ListBox, ListCount, ListIndex, ListItem, ListItemId, NewIndex, NewItemId |