Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

How to optimize ListView control to work faster?

$
0
0
I made a program which contains a LV control as the central part of it. Program takes records from a database and store them into LV which has 10 columns. Everything was fine while I had 400-500 records but now I have more than 5000 and I have to wait a few minutes to start to work.


Routine for adding data to LV is classic one.


VB Code:
  1. Do While dr.Read
  2.                 item1 = ListView1.Items.Add(dr("ID"))
  3.                 With item1
  4.                     .SubItems.Add(dr("row1"))
  5.                     .SubItems.Add(dr("row2"))
  6.                     .SubItems.Add(dr("row3"))
  7.                     .SubItems.Add(dr("row4"))
  8.                     .SubItems.Add(dr("row5"))
  9.                     .SubItems.Add(dr("row6"))
  10.                     .SubItems.Add(dr("row7"))
  11.                     .SubItems.Add(dr("row8"))
  12.                     .SubItems.Add(dr("row9"))
  13.                 End With
  14.             Loop

Is there a way to do anything with this?

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>