Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

Find & Delete String in Listbox

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
d4jaj1
Asked:
d4jaj1
1 Solution
 
MikeP090797Commented:
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
 
d4jaj1Author Commented:
I know that - what I don't know is how to find a string literal in the listbox?
0
 
philipleighsCommented:
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now