Solved

Find & Delete String in Listbox

Posted on 1998-01-26
3
308 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 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