Solved How can I get the info I need better than I do it right now?
Hi, I'm loading some info from an xml (which works fine, loading the info and showing it up is not the problem) but I work with that info in a really odd way so I wonder if there is any other better way.
Actually I have an XML which has a pair of values, something like:
ID="1" Name="Ana" ID="3" Name="Marta" (notice there is no ID=2) ID="4" Name="Pedro"
I have to show the names to the user so I use a combobox for it, and when the user selects a name I need to know the ID so..what I am doing now is using 2 combobox. The first one is going to be visible to the user with the names while the second one will be invisible and contain the IDs (one ID on each item). With that, if the user selects Marta for example, I know that Marta is the index 1 of the visible combobox.... then I select the index1 of the hidden combobox wich has the number 3 and I got the ID.
As I said its a really odd and ugly way so... is there any better way to do what I try?
I know I could just re-read the xml until the line N where N is the index of the combobox but I wanted to avoid having to re-read the xml (as its a file in the product of the enterprise and can cause some problems.
Thank you so much!
Each item in the combobox can have a variant data
So when you select one item, you can get the ID that way.
its a variant so it can be any data, but if you use a int, it has a fucntion to convert to int
@mrjj Oh wow! That helped a lot! So easy and didn't thought about it... Thank you a lot!
Good to hear. :)
Most Widgets where you can insert "Item"
have this data property.
@mrjj I don't know but never thought about it so that's why I did that "odd/botched job" and when you mentioned it was like a "Oh man! why didn't I thought in that before? Its so simple...." hahaha I'll keep it in mind henceforth.