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

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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.