Troubles with AddObject
Posted on 1998-02-28
My trouble is in C++ Builder but if you tell me something about Delphi Im vey grateful.
Well, I wish associate each item of a ComboBox (Client Name) with another text (Client Code), I think that i must do it with the method AddObject from Items, its prototipe is AddOboject(AnsiString,TObject), the code is
void __fastcall TForm1::Button1Click(TObject *Sender)
SQLText = "SELECT * FROM CLIENTES WHERE NOMBRE LIKE '";
SQLText = SQLText + ComboBox1->Text + "%'";
Query1->SQL->Text = SQLText;
Query1->Active = true;
indice = ComboBox1->Items->AddObject(Query1->FieldByName("N OMBRE")->AsString
Query1->Active = false;
Both ClientName, as CodeClient are on a database, as you see i associate the clientname(first parameter) with a TField Object, my trouble is that ...indice is ever the same!! ( indice ever has value equal to one, two...) and when i want retrieve from my Form. just stand the last item :((.