RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomListBox.Clear Method

Deletes all items from the list box.

Pascal
procedure Clear; override;
C++
virtual __fastcall Clear();

Use Clear to delete all of the items in the list box at once. Although the items in a standard list box are of type TStrings, use the Clear method of the list box rather than calling the Clear method of the Items property. This allows descendants of TCustomListBox to perform any other necessary clean-up in the Clear method, in addition to deleting the items from the Items property. Thus, applications should use

ListBox1.Clear;

 

ListBox1->Clear();

rather than

ListBox1.Items.Clear;

 

ListBox1->Items->Clear();

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!