How to find the item by assigned object in TComboBox ?
I have a combo box, where I'm storing values from database; name as item and ID (integer) as an object:
ComboBox1.Clear;
while not SQLQuery1.EOF do
begin
ComboBox1.AddItem(SQLQuery1.FieldByName('NAME').AsString,
TObject(SQLQuery1.FieldByName('ID').AsInteger));
SQLQuery1.Next;
end;
Assume, I have the following items in combo box:
Index Item Object
----------------------------
0 'Dan' 0
1 'Helmut' 2
2 'Gertrud' 8
3 'John' 14
Now, how do I find the index of such combo box item if I know just the object value ? Is there a function like GetItemByObject('8')
which could give me index 2 ?