如何删除ListBox1中的多项选中项?
应该不太难,只是一下子想不起来该如何写。

解决方案 »

  1.   

    for i := listbox1.items.count - 1 downto 0 do
      if listbox1.selected[i] then
        listbox1.items.delete(i)
      

  2.   

    for i:=listview.items.selcount-1 downto listview.itemindex do
    begin
       listview.delete(i); 
    end;
      

  3.   

    学习。。  For i:=0 to ListBox1.Items.Count-1 do                //传值 ;
        begin
          If ListBox1.Selected[i] = True  Then
             ListBox2.Items.Append (ListBox1.Items[i]);
        end;                          ////下面的就行
      i:=ListBox1.Items.Count-1 ;
      while  i>=0 do                                      //删除旧值 ;
       begin
         If ListBox1.Selected[i] = True  Then  ListBox1.Items.Delete(i);
         i:=i-1;
       end;
      

  4.   

    楼上几位的方法都是自己实现,其实Delphi(6/7)已经提供了这样的方法,直接调用就可以了
    ListBox1.DeleteSelected;
      

  5.   

    copy_paste(木石三)的方法不太可行, rlongriver(学习中) 回答最为详细在此特别感谢。