DesktopListBox.AddRows
From Xojo Documentation
Appends Item in a new row to the end of the list. Because it is called ParamArray, you can pass several items causing each item to be the value for a new row.
Appends a new row to the end of the list with each element of Item as a separate row.
Appends rows from the RowSet to the ListBox. If the ListBox does not have enough columns, more columns will be added.
Notes
Use LastAddedRowIndex to determine the last row added. In the case of hierarchical ListBoxes, AddRows appends Item to the subitems of the expanded row when called in the RowExpanded event. The theoretical maximum number of rows is over 2 billion but the actual number will be lower due to memory constraints.
Variant Usage
Note that you get a compile error if you pass a Variant to the AllAllRows method. When using a Variant, convert it first to string or array so the compiler knows which method you want to call:
Scrolling
If you are adding many rows to the ListBox, eventually the results will scroll off the bottom of the ListBox and no longer be visible. To make a newly added row visible, you have to scroll the listbox to the location of the newly added row. You can do this by setting the SelectedRowIndex property to the value of the newly added row like this:
Or you can manually scroll the ListBox to the right position:
Overriding
If you need to override AddRows, override the second version with items array. This is the main method which is called by the others.
Sample Code
The following line adds rows of months to a ListBox:
The following line adds rows of months to a ListBox using an array:
See Also
DesktopListBox.AddExpandableRow and DesktopListBox.AddRow methods