How to refresh a dialog box control
The following article uses options that are available starting with the Enterprise edition and project type.
This example will explain how to refresh a ComboBox control after the dialog containing it was loaded without using the “twin dialog“ method.
Please follow these steps:
1. create a new Enterprise or Architect project and go to Dialog Editor page
2. add a new dialog, on this dialog add a combobox and a push button using the toolbox
3. set the combobox public property to "COMBO" from the right pane
4. create a VBScript file (.vbs) that contains this script:
5. go to Custom Actions page and add the script as an attached custom action without sequence
6. now go to Dialogs page and add a published event on the button created that runs the VBScript custom action
7. build and run the package
When the dialog will appear, the combox will have an empty value because the property was not set to any value, this is correct. Press the created button, this will run the custom action that sets the property attached to the combobox to the string “New value“. It is a known Windows Installer bug that it cannot refresh a combobox control after a dialog has been loaded. Only after switching to a different dialog will the control be reloaded.
Here is what you have to do in order for the combobox property to be re-read:
8. after the published event that runs the VBScript custom action add a Refresh the current dialog published event
Rebuild the package and test it, you will see that, after you press the button, the combobox will display the new value of the property.