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: Populating values into Combo Box
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Oct 17, 2008
12:30 AM
Populating values into Combo Box
Hi,
I have created a new dialog and added a combo box control in it.
The combo box should be populated from the text file
E.g Populate.txt (Which contains value in the format)
One
Two
Threee
The values should be populated when user clicks on the NEXT button in the previous screen.
Please let me know how can i implement it in Installshield2009 BASIC MSI PROJECT.
How to create an action for Next and a script to populate combo box.
I have created a new dialog and added a combo box control in it.
The combo box should be populated from the text file
E.g Populate.txt (Which contains value in the format)
One
Two
Threee
The values should be populated when user clicks on the NEXT button in the previous screen.
Please let me know how can i implement it in Installshield2009 BASIC MSI PROJECT.
How to create an action for Next and a script to populate combo box.
(7) Replies
‎Oct 17, 2008
01:09 AM
Take a look at Knowledge Base article Q103295. It covers how to Dynamically Add and Remove Values from a Combo Box at Run Time.
‎Oct 17, 2008
04:34 AM
Hi,
I have used a below vb script in do action of combo box. But i am not getting any values dyanamically loaded to it.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\MyList.txt", ForReading)
Const ForReading = 1
Dim arrFileLines()
i = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
For Each strLine in arrFileLines
WScript.Echo strLine
Next
Any info on the above how to get the value populated.
I have used a below vb script in do action of combo box. But i am not getting any values dyanamically loaded to it.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\MyList.txt", ForReading)
Const ForReading = 1
Dim arrFileLines()
i = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
For Each strLine in arrFileLines
WScript.Echo strLine
Next
Any info on the above how to get the value populated.
‎Oct 20, 2008
12:59 AM
Hi,
please let me know how to populate the combo box , fetching the data from the text file. I have a sample code which does it. I have pasted it in above post. But i am not sure how to set doAction for running the script to populate.
please let me know how to populate the combo box , fetching the data from the text file. I have a sample code which does it. I have pasted it in above post. But i am not sure how to set doAction for running the script to populate.
‎Oct 20, 2008
02:09 PM
This can easily be done in Install Shield script project when you make a custom dialog. If you would like to know how, let me know.
‎Nov 10, 2008
01:40 AM
function PopulateListCombo(hMSI)
LIST StringList;
STRING svString, sPath;
NUMBER nResult, nPath;
NUMBER hDatabase, hCBOView, hView, hRec;
STRING szText;
number index, nCount;
STRING sQuery;
STRING hi ;
begin
index=0;
hDatabase=MsiGetActiveDatabase(hMSI);
sQuery="SELECT * FROM ComboBox WHERE Property='PROPNAME'";
nResult = MsiDatabaseOpenView(hDatabase,sQuery,hCBOView);
hRec=MsiCreateRecord(4);
StringList = ListCreate (STRINGLIST);
nResult = LaunchAppAndWait(SUPPORTDIR^"vbs2.exe",hi,LAAW_OPTION_WAIT);
ListAddString(StringList,hi,AFTER);
ListAddString(StringList,"ZAQ",AFTER);
ListAddString(StringList,"FAK",AFTER);
ListAddString(StringList,"MAM",AFTER);
nResult = nResult = ListGetFirstString (StringList, svString);
MsiRecordSetString(hRec,1,'TESTPROP');
MsiRecordSetInteger(hRec,2,index);
MsiRecordSetString(hRec,3,svString);
MsiRecordSetString(hRec,4,svString);
MsiViewModify(hCBOView,MSIMODIFY_INSERT_TEMPORARY,hRec);
nResult = ListGetNextString (StringList, svString);
while (nResult != END_OF_LIST)
index=index+1;
MsiRecordSetString(hRec,1,'TESTPROP');
MsiRecordSetInteger(hRec,2,index);
MsiRecordSetString(hRec,3,svString);
MsiRecordSetString(hRec,4,svString);
MsiViewModify(hCBOView,MSIMODIFY_INSERT_TEMPORARY,hRec);
nResult = ListGetNextString (StringList, svString);
endwhile;
MsiCloseHandle(hRec);
MsiViewClose (hView);
end;
LIST StringList;
STRING svString, sPath;
NUMBER nResult, nPath;
NUMBER hDatabase, hCBOView, hView, hRec;
STRING szText;
number index, nCount;
STRING sQuery;
STRING hi ;
begin
index=0;
hDatabase=MsiGetActiveDatabase(hMSI);
sQuery="SELECT * FROM ComboBox WHERE Property='PROPNAME'";
nResult = MsiDatabaseOpenView(hDatabase,sQuery,hCBOView);
hRec=MsiCreateRecord(4);
StringList = ListCreate (STRINGLIST);
nResult = LaunchAppAndWait(SUPPORTDIR^"vbs2.exe",hi,LAAW_OPTION_WAIT);
ListAddString(StringList,hi,AFTER);
ListAddString(StringList,"ZAQ",AFTER);
ListAddString(StringList,"FAK",AFTER);
ListAddString(StringList,"MAM",AFTER);
nResult = nResult = ListGetFirstString (StringList, svString);
MsiRecordSetString(hRec,1,'TESTPROP');
MsiRecordSetInteger(hRec,2,index);
MsiRecordSetString(hRec,3,svString);
MsiRecordSetString(hRec,4,svString);
MsiViewModify(hCBOView,MSIMODIFY_INSERT_TEMPORARY,hRec);
nResult = ListGetNextString (StringList, svString);
while (nResult != END_OF_LIST)
index=index+1;
MsiRecordSetString(hRec,1,'TESTPROP');
MsiRecordSetInteger(hRec,2,index);
MsiRecordSetString(hRec,3,svString);
MsiRecordSetString(hRec,4,svString);
MsiViewModify(hCBOView,MSIMODIFY_INSERT_TEMPORARY,hRec);
nResult = ListGetNextString (StringList, svString);
endwhile;
MsiCloseHandle(hRec);
MsiViewClose (hView);
end;
‎Jan 30, 2023
11:34 PM
I have got a case where i need to remove my combobox item during runtime. Is there a way where i can do it? I have been struggling to get this work from many days
Use case:
I have got a combobox and i have selected one item from it to do some customaction. In the next dialog i want the combobox item to get removed because i have already used it. So the remaining items needs to show apart from the one i have selected in the previous dialog.
Is there any piece of code which can make this work ?
Any help is highly appreciated .
‎Jan 31, 2023
10:31 AM
If you have an InstallScript project, have you tried the CtrlSetList function?
https://docs.revenera.com/installshield28helplib/LangRef/LangrefCtrlSetList.htm
Attached is an example. Rename the .txt files to .rul.
HTH