Code Modification Help Needed
Posted on 2007-10-03
I need some help modifying some code.
The code will basically searches and displays contents on a ListView.
This code works but it only displays the results of the search.
What I need it to do is the display the results of the test (Like it does already) and under that, the rest of the data (Not just the results).
So, if the ListView had 10 rows of data...and the search result was 2 found it will display these results First (It already does that)...and also the 8 rows remaining under that.
Here is the code:
procedure TForm1.ComboBox1Change(Sender: TObject);
i1, i2: integer;
s1:= ComboBox1.text; // our search-word
for i1:= listview1.items.count- 1 downto 0 do begin
b1:= pos(s1, listview1.items[i1].caption)> 0;
if not b1 then for i2:= 0 to listview1.items[i1].subitems.count- 1 do begin
if pos(s1, listview1.items[i1].subitems[i2])> 0 then begin
if not b1 then listview1.items.delete(i1);
Hope you can help!