Use AddObject('itemtext',TObje
If you need to store many data with each item, use a TList of records and have the data be the pointer to your TList.
Main Topics
Browse All TopicsHi all,
In Visual Basic I use properties ItemData to store number in ComboBox. But in Delphi I don't know how to store number in items of TComboBox. Please help me!
Thank you very much
Best regards
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi.
You might want to take a look at ComboBox.Items.Objects. A object is a pointer and you can store anything in it.
Example:
type
TIntegerObject = class(TObject)
private
FValue: Integer;
public
constructor Create(const AValue : integer);
property Value: Integer read FValue write FValue;
end;
constructor TIntegerObject.Create(cons
begin
FValue := AValue;
end;
procedure TForm1.Button1Click(Sender
var
C1: TComboBox;
begin
C1 := TComboBox.Create(Self);
C1.Parent := Form1;
C1.Items.AddObject('-1', TIntegerObject.Create(-1))
C1.Items.AddObject('-2', TIntegerObject.Create(-2))
ShowMessage(IntToStr(TInte
ShowMessage(IntToStr(TInte
end;
Note: You have to create your own TIntegerObject, otherwise your program will crash for some numbers, eg. -1, because -1 will be passed as lParam (it gets interpreted as an error code).
Markus
May be this simple example (Delphi 7) is helpful:
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 1 to 12 do
ComboBox1.AddItem(IntToStr
end;
procedure TForm1.ComboBox1CloseUp(Se
begin
ShowMessage(string(ComboBo
end;
emil
Business Accounts
Answer for Membership
by: kretzschmarPosted on 2003-04-23 at 04:13:36ID: 8379096
? tr(AIntege rValueHere ));
ostr(AFloa tValueHere ));
combobox1.items.add(inttos
or
combobox1.items.add(floatt