Re: How to perform ListBox search?


Posted by mnemo on November 17, 2000 at 13:27:18:

In Reply to: How to perform ListBox search? posted by Weirghn Ingrad on November 16, 2000 at 20:40:47:

: How to perform String search in List Box?
: Lets say when a user press a Button the aplication performs search for text string that was entered in Edit element, and the the string if found get selected. And how to make Next Search (if one string found, but ListBox contains three strings like were, weres, uwere and user is searching for 'were'?

something similar to this.. I dont have Delphi IDE here, so I cant test it.

for k := 0 to ListBox1.Items.Count - 1 do
  if ListBox1.Items.Strings[k]=Edit1.Text then
  begin
    ListBox1.ItemIndex := k;
    break;
  end;

/m


Related Articles and Replies: