cycling thru a listbox
Posted on 2004-04-01
I am trying to match items in a listbox with the caption of a lable using this code.
procedure TForm1.Timer1Timer(Sender: TObject);
I : integer;
for I := 0 to ListBox1.Items.Count -1 do
if label1.Caption = ListBox1.Items[i] then
showmessage ('match found' + IntToStr(listbox1.ItemIndex));
but the only matches that are found are from the last item in the listbox and not sure how to change the code so it will match ALL the items that are found instead of the last one and I am pretty sure that the index that will be returned in the showmessage function will not be correct either so any help there would be great to.