Recent

Author Topic: listbox2.items.Delete[listbox2.itemindex];  (Read 6109 times)

cazzajay

  • Jr. Member
  • **
  • Posts: 94
listbox2.items.Delete[listbox2.itemindex];
« on: December 13, 2009, 01:16:06 pm »
this doesnt work

its probably something really obvious but how do i delete the selected line item from a tlistbox

i tried 

listbox2.items.Delete[listbox2.itemindex]; 

and

listbox2.items[listbox2.itemindex].delete;

but for the first example i get a missing parameter error and the second i get illegal qualifier error.

the listbox is sorted alphabetically so ideally id like to "refresh" the box after deleting so that the line i delete doesn't leave a gap

any ideas on how to accomplish this feat?

thankee

cj
Windows XP 32 bit / Lazarus 1.0.6 / FPC 2.6.0

Mike J

  • Jr. Member
  • **
  • Posts: 54
  • Computer Programmer/www.NewsRx.com
    • ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ ᏗᏕᎶᏆᏍᏗ (Cherokee Language Lessons)
Re: listbox2.items.Delete[listbox2.itemindex];
« Reply #1 on: December 13, 2009, 02:35:54 pm »
Mayhaps:

  ListBox1.Items.Delete(INDEX);

  I did a [CTRL-SPACE] at the end of ListBox1.Items.
 then scrolled through the results, noticed there was a delete that requires an INDEX.
ᏙᎯ

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1946
Re: listbox2.items.Delete[listbox2.itemindex];
« Reply #2 on: December 13, 2009, 04:06:21 pm »
ListBox2.Items.Delete(ListBox2.ItemIndex);   

cazzajay

  • Jr. Member
  • **
  • Posts: 94
Re: listbox2.items.Delete[listbox2.itemindex];
« Reply #3 on: December 14, 2009, 01:44:08 am »
thanks guys i knew the solution was something simple!
Windows XP 32 bit / Lazarus 1.0.6 / FPC 2.6.0

 

TinyPortal © 2005-2018