2

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.

0

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 For the site link, I remember this site. Though I think subclassing might be beyond what the OP was looking for. There are commercial grids that also offer the virtual functionality as well and he may get more support going that route.
2

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.

2 Comments

., thaks for the clever tips. Well, i do agree that listview is really not a good choice for large array. What is the possible better choice rather than listview?
@NokImchen The point tcarvin makes is simply that delivering 50K rows to a user in any view is not practical, what is it that the user will be doing with these records?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.