有两个列表框,相互比较各自的条目,若listbox2中含有listbox1中的条目,则把listbox2列表框中该条目清除。我写了代码,可总报错,为什么?这是我所写的代码: for i:=0 to ListBox2.Items.Count-1 do
begin
for j:=0 to listbox1.Items.Count-1 do
begin
if listbox2.Items.Strings[i]=listbox1.Items.Strings[j]
then
listbox2.Items.Delete(i);
end;
end;
begin
for j:=0 to listbox1.Items.Count-1 do
begin
if listbox2.Items.Strings[i]=listbox1.Items.Strings[j]
then
listbox2.Items.Delete(i);
end;
end;
begin
for j:=listbox1.Items.Count-1 dowwnto do
begin
if listbox2.Items.Strings[i]=listbox1.Items.Strings[j]
then
listbox2.Items.Delete(i);
end;
end;
for i:=listbox2.Items.Count-1 downto 0 do
begin
for j:=listbox1.Items.Count-1 downto 0 do
begin
if listbox2.Items.Strings[i]=listbox1.Items.Strings[j]
then
listbox2.Items.Delete(i);
end;
end;
对不起,是我的网络慢,不是我诚心想copy楼上的
************************************************