I'm experimenting with my own dialogs and I'm getting the hang of some parts of them. I've placed a combobox on a form and I can successfully get the text of the selected item. What I can't figure out is how I put the selected item index into a variable.
Can someone tell me how?
Combobox.
Styx,StyX wrote:You do not place indexes on them, but you write the actual value to a variable to the variable you specify.
File Attached:
<a>16.02.png
Sorry, I did not explain that too well when I posted. If I have items A, B, and C in the combobox I could get value B like you described and that works ok. I'm assuming the combobox works the same way I'm familiar with in .Net: that is the item index of A is 0, B is 1, and so on.
What I'd like to know is that if B is selected in the combobox then how do I return 1 as the value? I have an existing IS project where the item index number is written to a database and not the user-friendly value that they see in the combobox. Hopefully that clears up the confusion of what I wrote.
Then again, it's Monday morning and I've not had any coffee yet. I could be forgiven for being confused.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
I found this previous thread:
http://www.installaware.com/forums/view ... 931988b4e9
It seems, then, that you can't get the ItemIndex which is a bit unfortunate. I suppose I could check which value is selected in the combobox and then translate that into a number in the MSIcode. It poses the problem that if you want to change the eligible values in the combobox you'd have to change the logic in the MSIcode unless someone can suggest another idea?
The problem I'd have if we convert our IS projects to IA is that we have one combobox with about 40+ selectable items. I could work with it in IA but maybe there is another solution.
http://www.installaware.com/forums/view ... 931988b4e9
It seems, then, that you can't get the ItemIndex which is a bit unfortunate. I suppose I could check which value is selected in the combobox and then translate that into a number in the MSIcode. It poses the problem that if you want to change the eligible values in the combobox you'd have to change the logic in the MSIcode unless someone can suggest another idea?
The problem I'd have if we convert our IS projects to IA is that we have one combobox with about 40+ selectable items. I could work with it in IA but maybe there is another solution.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
-
MichaelNesmith
- Posts: 3452
- Joined: Thu Dec 22, 2005 7:17 pm
- Contact:
Michael,MichaelNesmith wrote:Why do you need the item index? Isn't it more valuable to obtain the exact value of the selected item instead?
The item index would be better in this case as it directly relates to a column value in a database. The dialog would give the friendly name and the item index would be used when writing to a database. At this moment the friendly names and their database values are paired but the item index is the key value for the constraint. As I say, it's nothing that can't be handled in MSIcode.
This gets me thinking on something, I suppose I could add items to the combobox at design time and use selectable values like 0 - A or 1 - B or 2 - C, something like that. I'd have to look in the MSIcode statements and see if there are any string functions that will get whatever is before the "-". That would give me the integer value I need for the database insert statements.
Then again, I could always pass the combobox value like A into a stored procedure call and let it do the translation on the database at runtime. We never use direct SQL insertion so everything is handled with stored procedures. Those are some ideas I can experiment. Heck! I'm committing to IA while I'm still evaluating it for purchase...
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP

