Solved

Tlistbox

Posted on 2001-06-29
2
144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
edey earned 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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