Solved

Find & Delete String in Listbox

Posted on 1998-01-26
3
296 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
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 10 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 Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

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

13 Experts available now in Live!

Get 1:1 Help Now