Listbox speed improvement

We’d like to insert 100.000s of rows into a listbox as fast as possible.
Any ideas how to improve this significantly?

https://drive.google.com/open?id=13j1MMxCFSUhGZ2p_QeNRGT4m7qhaZvJd

feedback://showreport?report_id=59602

dont put so much rows in a listbox.
instead, use a cache mecanism, store the datas in a in-memory sqlite database
and display only the visible rows in the listbox.

make a containercontrol with a listbox and a scrollbar
the scrollbar will be set to the maximum of records, and synchronized with the listbox.

this way, even millions of records can be displayed fluently
and more, even on a remote database this is still fluent for the user.

or buy a readymade litbox that handles this cache system : data-on-demand-listbox, pidog dataview, etc

this seems the fastes way ca. 500 ms if you have the data ready with EndOfLine

list.Visible = False list.InitialValue =ini list.Visible = True

it make no sense to add 100000 if you only see 100

Never put that many actual rows in listbox; instead use “virtual” rows that dynamically show just visible content. There are many approaches to that, but here are two methods I use:

Kem’s Data-On-Demand Listbox

This one is shareware and subclassed from a standard Xojo Listbox. The above page even has a link to an example project with a 5 million record sample data file. Blazingly fast. Try it. The response time for me is incredible even when pulling rows from a remote database and dragging the scrollbar quickly. You’ll never think about stuffing 100k actual rows of data in a listbox again.

piDog’s DataView

This is not subclassed from a Xojo Listbox. It is built from the ground up on a canvas which allows it to LOTS of things not practical with a Listbox subclass. Way to many to mention. It can also do data on demand too. But beyond that there are LOTS of things it can also do. I originally got it so I could have cells span rows or columns, variable height rows, lock columns on the left, etc aside from dynamic data sources. Thinking of it as a listbox on steroids is an understatement.

As to the original question I found that the fastest way to display text-only content is:

lbTestListBox.ScrollBarVertical = False

#Pragma BackgroundTasks False
#Pragma BoundsChecking False
#Pragma NilObjectChecking False
#Pragma StackOverflowChecking False

<populate the listbox...>

lbTestListBox.ScrollBarVertical = true

Disabling the scrollbar results in a significant increase in speed and responsiveness of my programs (19r1.1. MSSQL, MBS SQL).