I have an array of 50k items. I want to load all the items into my listview control as fast as possible. Using a loop is not the solution as a loop is very slow.
2 Answers
The underlying ListView control has a virtual mode which means your app only passes a count to the control and it then calls back periodically to get information on the entries that are visible. Unfortunatly, this functionality is not exposed by the VB6 common controls but you can still use the underlying control.
See this vbVision example.
1 Comment
There is no way to load in bulk as far as I know, but there are other tricks to make it a bit faster. One is to prevent the control from updating (repainting) during the load. This can be done as simply as hiding it while loading. Another technique is to load a chunk of records up front (say 2K) and then use a timer to load the rest in chunks in the background.
But honestly, I doubt the usefulness of a grid with 50K items displayed. That is too much data to present to a user in one pass. Have you considered refactoring your UI to limit the amount of data a user has to sift through at one time.