To Delete all selected items in a Listbox:
To delete MULTIPLE selected items in a list box:
you must make sure ListBox1.MultiSelect = true
Code:
procedure TForm1.Button1Click(Sender: TObject); var i: integer; begin for i := ListBox1.Items.Count - 1 downto 0 do if ListBox1.Selected[i] then ListBox1.Items.Delete(i); end;
To delete MULTIPLE selected items in a list box:
you must make sure ListBox1.MultiSelect = true
Code:
var ii : integer; begin with ListBox1 do begin for ii := -1 + Items.Count downto 0 do if Selected[ii] then Items.Delete(ii) ; end; end;