我想刪除我的列表視圖中的重複項。刪除Delphi中的重複列表視圖
此功能:
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;
不會刪除重複項。它有什麼問題?
它正在做什麼,你不希望它做什麼? – Nat 2010-04-16 03:43:59
我的意思是它沒有刪除dublicates先生 – radick 2010-04-16 03:51:15