954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to search a listview for same items?

Am looking for a way to search a listview for selected captain items and then for it to remove all the items that were found.

demo idea

to loop full list to find search string that can be changed via edit and then to delete all items that are the same as edit text

Edit text would be 'Simon1'

Items in list ListView would be like

Simon1 - deleted
Simon1 - deleted
Simon1 - deleted
Mark2 - undeleted
steven2 - undeleted
bob2 - undeleted

so on any one know how to do this?


thanks alot

Simon180
Light Poster
29 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

It would be something like:

var
  li: TListItem;
begin
  li := ListView1.FindCaption(0, 'Simon', False, True, False);
  while li <> nil do begin
    li.Delete;
    li := ListView1.FindCaption(0, 'Simon', False, True, False);
  end;
end;
pritaeas
Posting Expert
Moderator
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You