Board index » cppbuilder » Delete Item from ListBox

Delete Item from ListBox


2003-11-27 01:59:24 AM
cppbuilder80
Hello, I hate to ask questions like that because I'm sure there is a very
very easy answer but, after builder docs, newsgroup and google, couldn't
find the answer, Here it is:
How can I delete an Item from a ListBox? I would have thought that Selecting
the Items and hitting the Del key would have worked, but no. Do I have to
write code with the OnKeyPress and find out if it is the Del key and do
ListBox->Items->Delete?
Ygeoy
 
 

Re:Delete Item from ListBox

"Y. Geoy" < XXXX@XXXXX.COM >wrote in message
Quote
How can I delete an Item from a ListBox?
The Items property is a TStrings instance. The TStrings class has a
Delete() method which takes an Index parameter specifying the item to delete
from the list.
Quote
I would have thought that Selecting the Items and hitting the Del
key would have worked, but no.
No, it is not designed for that. If you want that kind of functionality,
you have to code it yourself.
Quote
Do I have to write code with the OnKeyPress and find out if
it is the Del key and do ListBox->Items->Delete?
Yes.
Gambit