#include... wxArrayString arr; arr.Add("apple"); arr.Add("banana"); arr.Clear(); // clears all elements from the array
#includeIn this example, a wxListBox is created and populated with three items. The `GetStrings` method is used to retrieve a wxArrayString containing the list box items. The `Clear` method is then called on the wxArrayString to clear all elements, and `Clear` is also called on the wxListBox to remove all items from the list box. Package/Library: wxWidgets... wxListBox* listBox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); listBox->Append("item 1"); listBox->Append("item 2"); listBox->Append("item 3"); ... wxArrayString strings = listBox->GetStrings(); strings.Clear(); // clears all elements from the array listBox->Clear(); // clears all items from the list box