i: Integer;
begin
  for i := 0 to (FileListBox1.Items.Count - 1) do begin
  if FileListBox1.Selected[i] then 
  ListBox1.Items.delete(i);
end;

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
         listbox1.Items.Delete(listbox1.Itemindex);
    end;
      

  2.   

    begin 
      if listbox1..Items.Count=0 then exit;
      if listbox1.select[Listbox1.ItemIndex] then
       Listbox2.Items.Delete(Listbox1.itemindex);
     
    end;
      

  3.   

    // exception handler
    begin
      try
        listbox1.Items.Delete(listbox1.Itemindex);
      finally
        //  处理listbox1为null
      end;
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      i: Integer;
    begin
      for i := 0 to (FileListBox1.Items.Count - 1) do begin
      if FileListBox1.Selected[i] then 
      ListBox1.Items.delete(i);
    end;
      

  5.   

    With ListBox1.Items do
    begin
       if Indexof('Temp') >-1 then
          Delete(IndexOf('Temp'));
    end;
    删除'Temp'