wcLoadList() Function
- Last UpdatedNov 23, 2018
- 1 minute read
Loads a list box or combo box with new items from a file.
Category
windows control
Syntax
[ErrorNumber=]wcLoadList("ControlName", "Filename");
Parameters
ControlName
The name of the windows control object. For example, ListBox_1. Actual string or message tagname.
Filename
Contains the name of a file. If you do not supply a complete path name as part of the message parameter, the function checks the application directory for the message file. Actual string or message tagname.
Remarks
For a list of returned error numbers, see Understand windows controls error messages.
If you use external files to fill the list and combo boxes, they must follow specific formatting and contain specific information. Format:
ControlType, ListCount
ListItem, ItemIndex
ListItem, ItemIndex
: :
: :
ListItem, ItemIndex
The ControlType is either COMBOBOX or LISTBOX.
For example, you want to load a list file to a combo box and it contains three items to select from and those items have no item data assigned. The format of the file appears as:
COMBOBOX, 3
Chocolate, 0
Vanilla, 0
Strawberry, 0
The COMBOBOX is the control type. The list count is 3 for Chocolate, Vanilla, and Strawberry. Chocolate is then listed as the first item or position 1. Vanilla as position 2, and Strawberry as position 3. Each of these items has a data value of 0.
For more information on item data, see wcSetItemData() Function.
Applies To
List boxes and combo boxes.
Example(s)
The following statement loads a properly formatted list (located in c:\wclist.txt.) into a combo box:
wcLoadList("Combobox_1", "c:\wclist.txt");
See Also
wcAddItem(), wcSaveList()