Summary
How to Dynamically Populate a List Box at Runtime.
Synopsis
The MSI tables must be modified at runtime in order to populate a listbox dynamically.
This can be done from an InstallScript Custom Action.
Discussion
Create an InstallScript Custom action and populate it with code like the examples below:
Call this function in Installscript to get a view of listbox items to make changes to:
MsiDatabaseOpenView(hDatabase, "SELECT * FROM ListBox", hView);
Iterate through the view to find last position of last item in list:
while ((MsiViewFetch(hView,hFetchRec) != ERROR_NO_MORE_ITEMS) && i<20)
i++;
//NumToStr(svString,i);
//MessageBox(svString,INFORMATION);
endwhile;
Then create a record to insert into the view that creates a new entry:
hRec = MsiCreateRecord(4);
MsiRecordSetString(hRec, 1, "TEST"); // Column1: Property tied to the entry
MsiRecordSetInteger(hRec, 2, i+1); // Column2: Display order of item
MsiRecordSetString(hRec, 3, svValue); // Column3: Value to set property to
MsiRecordSetString(hRec, 4, svDisplay); // Column4: Display text for item
Insert Record into the view:
MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRec);
Close the view:
MsiViewClose(hView);
Additional Information
Attached is a sample project with a dialog that adds items to a listbox.
Related Articles
Populating A List Box Dynamically At Run Time 5Number of Views Populate A ComboBox At Runtime With VBScript 3Number of Views Dynamically Add and Remove Values from a Combo Box at Run Time 4Number of Views Set property with Suite Checked List Box 5Number of Views How do You Add a Flag so FlxCapabilityResponseGetVendorDictionary Detects Returns at Runtime? 8Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago