利用属性Duplicates来做避免:
var
sl : TStringList;
begin
sl := TStringList.Create;
with sl do
begin
Sorted := True;
Duplicates := dupIgnore;
//
// 在这里添加 items,所有雷同的会忽略
//
Add(Input1.text);
end;
ListBox1.Items.Assign(sl);
sl.Free;
end;
发布: 2008-6-26 17:27 | 作者: admin | 来源: | 查看: 0次
利用属性Duplicates来做避免:
var
sl : TStringList;
begin
sl := TStringList.Create;
with sl do
begin
Sorted := True;
Duplicates := dupIgnore;
//
// 在这里添加 items,所有雷同的会忽略
//
Add(Input1.text);
end;
ListBox1.Items.Assign(sl);
sl.Free;
end;