Solved

If Listbox1 string exist in Listbox2 then the item should be deleted

Posted on 2009-03-30
1
295 Views
Last Modified: 2012-05-06
Hey all,

I've got a Listbox1 and Listbox2.

Both are filled with about 50-100 strings and sometimes they contain the same string, if they do I would like for (via button1.click) all the items in Listbox1 that already exist in Listbox2 to be deleted from Listbox1.
0
Comment
Question by:MerlaP83
[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
1 Comment
 
LVL 14

Accepted Solution

by:
SteveBay earned 125 total points
ID: 24020379

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

Open in new window

0

Featured Post

Technology Partners: 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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month7 days, 10 hours left to enroll

632 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