Keep ID-value after using Combobox
I want my users to pick an item in a Windows Forms combobox. To fill that
combobox I use a SSQLS like so:
sql_create_2(TblUrensoort, 2, 0, string, UrensoortOmschrijving, int,
UrensoortID);
--
mysqlpp::Query qUrensrt = con.query();
qUrensrt << "select UrensoortOmschrijving, UrensoortID from TblUrensoort";
vector resUrensrt;
qUrensrt.storein(resUrensrt);
cBUren->Items->Clear(); //empty the combobox
vector::iterator it;
mysqlpp::Row rowUrensrt; //still here from an attempt without SSQLS
for (it = resUrensrt.begin(); it != resUrensrt.end(); ++it) {
String ^ a = gcnew String(it->UrensoortOmschrijving.c_str());
AddMessage(a);// AddMessage function like it is in the example.
}
This works just OK, but this way, through the conversion, I disconnect the
ID and the String.
Now here's my problem: After my user has made a choice, I want to continue
in my program with the "ID-value" instead of the "String-value". But as far
as I can see there is no way that I can get the two "connected" again as
they were in the vector. (Without doing another query!)
I have thought about using an Arraylist, but since I would have to fill that
with the values from the vector that idea seems to me like reinventing the
wheel.
Can anybody enlighten me?
Received on Wed Jul 25 11:30:33 2007
This archive was generated by hypermail 2.1.8
: Thu Aug 09 2007 - 19:28:34 EDT
|