Solved

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

Posted on 2009-03-30
1
289 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
1 Comment
 
LVL 14

Accepted Solution

by:
SteveBay earned 125 total points
Comment Utility

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now