Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Example: TreeList.ColumnCount, TreeList.Columns

The following sample code populates a string list with column captions. The GetColumnsList method uses the Columns and ColumnCount properties to get access to the collection of columns within the control and to determine the number of columns within the collection.

Note that the AColumns parameter passed to the GetColumnsList method should be already initialized.

procedure GetColumnsList(AColumns: TStringList);
var
  I: Integer;
begin
  for I := 0 to cxTreeList.ColumnCount - 1 do
    AColumns.AddObject(cxTreeList.Columns[I].Caption.Text, cxTreeList.Columns[I]);
end;