Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Tlistbox

Posted on 2001-06-29
2
Medium Priority
?
152 Views
Last Modified: 2010-04-06
I want to delete selected items in a list box.


for i := 0 to (ListBox1.Items.Count - 1) do begin
  try
    if ListBox1.Selected[i] then
    begin

  //  I want do remove selected items in this list box here
// is I on the right track or not.
// I now the delete function is not here it is watt I need from you.
    end;
 finally
   
   end;
0
Comment
Question by:Dark_King
2 Comments
 
LVL 6

Accepted Solution

by:
edey earned 150 total points
ID: 6239263
Try this:

var
   ix : integer;
begin
     ix := 0;
     while (ix < listBox1.items.count) do
           if listBox1.Selected[ix] then
              listBox1.items.delete(ix)
           else
               inc(ix);

GL
Mike
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6239267
or

var i: Integer;
begin
  for i := ListBox1.Items.Count - 1 downto 0 do
    if ListBox1.Selected[i] then
      ListBox1.Items.Delete(i);
end;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question