Einzelnen Beitrag anzeigen

Benutzerbild von chaosben
chaosben

Registriert seit: 27. Apr 2005
Ort: Görlitz
1.358 Beiträge
 
Delphi XE2 Professional
 
#2

Re: Listview von doppelten Einträgen befreien.

  Alt 26. Okt 2005, 05:50
Probiers mal damit:
Delphi-Quellcode:
procedure TForm4.Doppelkiller(LV: TListview);
var
  slItems : TStrings;
  idx : Integer;
begin
  if (not Assigned(LV)) then
    exit;
  try
    slItems:=TStringList.Create;
    Lv.Items.BeginUpdate;
    for idx:=LV.Items.Count-1 downto 0 do
    begin
      if (slItems.IndexOf(LV.Items.Item[idx].Caption)=-1) then
        slItems.Add(LV.Items.Item[idx].Caption)
      else
        LV.Items.Delete(idx);
    end;
    Lv.Items.EndUpdate;
  finally
    slItems.Free;
  end;
end;
Benjamin Schwarze
If I have seen further it is by standing on the shoulders of Giants. (Isaac Newton)
  Mit Zitat antworten Zitat