This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Populate Combobox from a XML File using VBScript
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 21, 2009
11:19 AM
Populate Combobox from a XML File using VBScript
Can somebody please post some code to show how to fill/populate a COMBOBOX with values gotten from a XML file. I am trying to do this in a CustomAction
My XML file is in the following format
REGION1
10
REGION2
20
If you have a solution how to do this from a TEXT file, please share it.
Appreciate all your responses
Thanks in advance
My XML file is in the following format
If you have a solution how to do this from a TEXT file, please share it.
Appreciate all your responses
Thanks in advance
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 22, 2009
02:16 PM
I solved it myself. Posting here so it could be of use to someone ...
Here is the VBScript Code to parse my xml file, which is located in the same directory as my setup.exe
This script is in a CustomAction which I hooked up to be invoked when the 'Next' button of the previous dialog is clicked.
Set MsiDb = Session.Database
Set MsiInstall = Session.Installer
Set MsiView = MsiDb.OpenView("SELECT * FROM ComboBox")
index = 1
strFilePath = Session.Property("SETUPEXEDIR")
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "False"
xmlDoc.Load(strFilePath & "\regions.xml")
strQuery = "/Regions/Region"
Set objNodeList = xmlDoc.selectNodes(strQuery)
For Each objNode in objNodeList
strRegionName = objNode.SelectSingleNode("RegionName").Text
strRegionValue = objNode.SelectSingleNode("RegionValue").Text
'Now Populate the ComboBox with the strRegionName and strRegionValue items
MsiRecord = MsiInstall.CreateRecord(4)
MsiRecord.StringData(1) = "REGION" 'The Name of the Property
MsiRecord.IntegerData(2) = index 'The Sequence/Order in the ComboBox
MsiRecord.StringData(3) = strRegionValue 'VALUE of the Item in the List
MsiRecord.StringData(4) = strRegionName 'TEXT to be displayed to the user
Call MsiView.Execute(MsiRecord)
Call MsiView.Modify (7, MsiRecord)
'MsgBox strRegionName & vbCr & vbLf & strRegionValue & vbCr & vbLf
index =index + 1
Next
Call MsiView.Close
'Cleanup
Set xmlDoc = Nothing
Thnx
Here is the VBScript Code to parse my xml file, which is located in the same directory as my setup.exe
This script is in a CustomAction which I hooked up to be invoked when the 'Next' button of the previous dialog is clicked.
Set MsiDb = Session.Database
Set MsiInstall = Session.Installer
Set MsiView = MsiDb.OpenView("SELECT * FROM ComboBox")
index = 1
strFilePath = Session.Property("SETUPEXEDIR")
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "False"
xmlDoc.Load(strFilePath & "\regions.xml")
strQuery = "/Regions/Region"
Set objNodeList = xmlDoc.selectNodes(strQuery)
For Each objNode in objNodeList
strRegionName = objNode.SelectSingleNode("RegionName").Text
strRegionValue = objNode.SelectSingleNode("RegionValue").Text
'Now Populate the ComboBox with the strRegionName and strRegionValue items
MsiRecord = MsiInstall.CreateRecord(4)
MsiRecord.StringData(1) = "REGION" 'The Name of the Property
MsiRecord.IntegerData(2) = index 'The Sequence/Order in the ComboBox
MsiRecord.StringData(3) = strRegionValue 'VALUE of the Item in the List
MsiRecord.StringData(4) = strRegionName 'TEXT to be displayed to the user
Call MsiView.Execute(MsiRecord)
Call MsiView.Modify (7, MsiRecord)
'MsgBox strRegionName & vbCr & vbLf & strRegionValue & vbCr & vbLf
index =index + 1
Next
Call MsiView.Close
'Cleanup
Set xmlDoc = Nothing
Thnx
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 27, 2011
07:54 AM
I tried this script and can't get it to work