<div class="meta" robots="noindex">

</div>

# ListBox.AddFolder

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `DesktopListBox.addExpandableRow<desktoplistbox.addexpandablerow>` as a replacement.

</div>

## Description

Appends *text* in a new row to the end of the list and adds disclosure triangle only if the Hierarchical property is set to `True</api/language/true>`.

## Notes

For multi-column ListBoxes, *Item* is always assigned to column zero. In the case of hierarchical ListBoxes, <span class="title-ref">AddFolder</span> appends *Item* to the subitems of the expanded row when called in the ExpandRow event.

## Sample code

The following example adds creates a hierarchical `ListBox</api/deprecated/listbox>`. Note that <span class="title-ref">AddFolder</span> must be called to create the hierarchical relationship.

``` xojo
Dim u As Integer
Dim s1, sub1 As String
Me.ColumnWidths = "150,0"
s1 = "Michigan,Ohio,Minnesota"
sub1 = "Grand Blanc,Bad Axe,Flint,Benton Harbor,"_
+ "Detroit;Cleveland,Columbus,Akron,Pleasantville;St. Paul,Frostbite Falls"
u = CountFields(s1, ",")
For i As Integer = 1 To u
  If NthField(sub1, ";", i) <> "" Then
    Me.AddFolder("")
    Me.Cell(i - 1, 1) = NthField(sub1, ";", i)
  End If
  Me.Cell(i - 1, 0) = NthField(s1, ",", i)
Next
Me.ColumnCount = 1
```

## Compatibility

All projects types on all supported operating systems.
