cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
toftof
Level 4

ListBox populated with temp data

Hi,

I am trying to populate a ListBox with a VB Script at runtime in my basic MSI project.

The trouble is every time I run it, the control is populated with "#temp0005", not the value I actually set it to.

After clearing the ListBox, I add a fixed value as follows:


Set oViewList = Session.Database.OpenView("SELECT * FROM `ListBox` WHERE `Property`='PYTHONVERSIONS'")

r = 1
Set oReccombo = Session.Installer.CreateRecord(4)
oReccombo.StringData(1) = "PYTHONVERSIONS"
'MsgBox "StringData(1) is: " & oReccombo.StringData(1)
oReccombo.IntegerData(2) = 1
'MsgBox "StringData(2) is: " & oReccombo.StringData(2)
oReccombo.StringData(3) = "Zob"
'MsgBox "StringData(3) is: " & oReccombo.StringData(3)
oReccombo.StringData(4) = "Zob"
'MsgBox "StringData(4) is: " & oReccombo.StringData(4)
oViewList.Modify msiViewModifyInsertTemporary, oReccombo
oViewList.close



The CA is run after CostFinalize in the Install UI sequence. But the ListBox is populated with "#temp0005" instead of "Zob".

Thanks in advance.
🙂
Labels (1)
0 Kudos
(3) Replies
hidenori
Level 17

I think that you need to call the Execute method on the View object before adding a record as follows:

Set oViewList = Session.Database.OpenView("SELECT * FROM `ListBox`")

oViewList.Execute

r = 1
Set oReccombo = Session.Installer.CreateRecord(4)
oReccombo.StringData(1) = "PYTHONVERSIONS"
'MsgBox "StringData(1) is: " & oReccombo.StringData(1)
oReccombo.IntegerData(2) = 1
'MsgBox "StringData(2) is: " & oReccombo.StringData(2)
oReccombo.StringData(3) = "Zob"
'MsgBox "StringData(3) is: " & oReccombo.StringData(3)
oReccombo.StringData(4) = "Zob"
'MsgBox "StringData(4) is: " & oReccombo.StringData(4)
oViewList.Modify msiViewModifyInsertTemporary, oReccombo
oViewList.close

Hope that helps.
0 Kudos
toftof
Level 4

Thanks, but that didn't help unfortunately.

Another thing I noticed: the ListBox is initially populated with "3202DC". If I then hit next and back, the value is then "#temp0005".

Any other ideas?
0 Kudos
RobertDickau
Flexera Alumni

You might also be missing a Fetch or two. For an example, please see this ancient newsletter tip (PDF): http://resources.flexerasoftware.com/web/pdf/archive/msiaccess.pdf.

(Beware obviously bad formatting and line breaks in the example there, such as "WH ERE". The similar InstallShield help topic "Windows Installer API Functions Example" has the queries and function sequence correct.)
0 Kudos