?
Solved

Find & Delete String in Listbox

Posted on 1998-01-26
3
Medium Priority
?
316 Views
Last Modified: 2010-08-05
How do I find and delete a string in a listbox?  The delete method needs an integer, so how do I match the Integer to the String?
0
Comment
Question by:d4jaj1
[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
3 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1357610
First you list throught the list to find the string and get it's index, and then you delete it using he index you've got
0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1357611
I know that - what I don't know is how to find a string literal in the listbox?
0
 
LVL 3

Accepted Solution

by:
philipleighs earned 40 total points
ID: 1357612
If your list box is called ListBox1 and you want to delete an item called "delete me" from the list, you can do this:

  var Index: Integer;
begin
Index := ListBox1.Items.IndexOf('delete me');
if Index > -1 then
    ListBox1.Items.Delete(Index);
end;

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

801 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