Changing Existing Elements in a List
InstallShield 2026
Call the ListSetCurrentString function to change the value of an element in a string list. Remember that only the current element may be changed, so be sure to make the string you want to update the current string in the list.
Call the ListSetCurrentItem function to change the value of an element in a number list. Again, the item that you want to update must be the current element in the list.
The example below demonstrates calling ListSetCurrentItem to change the value of the current item in a number list. The ListSetCurrentString function works in the same manner, but with a string list and string variables.
// Create a list and verify its creation.
listID = ListCreate (NUMBERLIST);
if (listID = LIST_NULL) then
MessageBox ("Unable to create list.", SEVERE);
abort;
endif;
// Add items (1078 and 304) to the list.
nItem = 1078;
ListAddItem (listID, nItem, AFTER);
nItem = 304;
ListAddItem (listID, nItem, AFTER);
// Current item is the second item (304).
// Now set current item to new value (305).
nItem = 305;
ListSetCurrentItem (listID, nItem);
ListDestroy (listID);
See Also