Solved

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

Posted on 2009-03-30
1
290 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 211
error 1.1 400 Bad request idhttp delphi 18 55
Mobile Keyboard covers the display of the TMemo 3 78
Performance of SQL statement 37 100
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…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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