deleting dublicates in listview delphi

Posted by radick on Stack Overflow See other posts from Stack Overflow or by radick
Published on 2010-04-16T03:15:32Z Indexed on 2010/04/16 3:23 UTC
Read the original article Hit count: 277

Filed under:

hi all

I am trying to remove dublicates in my listview

my function like this below

procedure RemoveDuplicates(const LV:TbsSkinListView);

var i,j: Integer;

begin LV.Items.BeginUpdate;

LV.SortType := stText; try

for i := 0 to LV.Items.Count-1 do  begin

      for j:=i+1 to LV.Items.Count-1 do

      begin  if  SameText(LV.Items[i].SubItems[0],

LV.Items[j].SubItems[0]) and SameText(LV.Items[i].SubItems[1], LV.Items[j].SubItems[1]) and SameText(LV.Items[i].SubItems[2], LV.Items[j].SubItems[2]) and SameText(LV.Items[i].SubItems[3], LV.Items[j].SubItems[3]) then

LV.Items.Delete(j);

end;

  end;   finally

LV.SortType := stNone;

LV.Items.EndUpdate;   end;

ShowMessage('Deleted');

end;

but its not doing what i intended

can anyone help me ?

© Stack Overflow or respective owner

Related posts about delphi