How to use ListView to quickly display more than 10000 records in VB

Source: Internet
Author: User

Light from the point of code optimization, personal support yunyu97, in fact, if the use of the control of what the gap between the compiler language is not very large, because most of the operation is done in the code in the control. Even if the use of VB, optimization is good, speed is also very fast.

In this example, the code for YUNYU97 can be further optimized because the number of ListView existing rows is known:

Dim Nitems As ListItems
Dim nitem As ListItem
Dim i As Long with
listview1.listitems for
i = 0 to 10000
 with. Add (,, i + 1)
. SubItems (1) = ("?? O?°? ")
. SubItems (2) = ("?? O?°? ")
. SubItems (3) = ("?? O?°? ")
End and
Next I
with

This is tested on my T60 machine, and 10000 lines are only 0.18 seconds.


Of course, if you look at it from a design point of view, adding 10000 rows of data to ListView is not a good solution in itself, consuming memory. And users do not need to view 10,000 records at the same time, the display can not display, so segmentation or pagination to join is the best way.

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

Simple. Practical.
Initialize subprojects before loading to parent project
Greatly reduces the depth of the reference
Increase the speed.


Author: Zeliqing (Lee) qq:14035344

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.