How can I delete items at run-time?
Applies To: C++Builder 1 or higher
Category: Knowledge Base
- Start a new project using File | New Application.
-
- Add a ListBox. Insert the items First and Second.
-
- Add two (2) Buttons. Set their OnClick event to:
-
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- ListBox1->Items->Delete(1);
- }
-
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- ListBox1->Items->Clear();
- }
-
- When you click the first button, the second item will be deleted. When you click the other button, all the items in the ListBox will be deleted.
C++Builder Developer's Network
Copyright © Yoto Yotov