Slow ListView - solution?

G

Guest

I am working on a database app in vb.net and have been using ListViews
to display read only tables of data. Didn't want to use a DataGrid for
various reasons.

The problem I found was that when populating the listview by iterating
through a dataset and calling ListView.Add() it took forever to load
the data. Well maybe not forever - but 10,000 records took 14 seconds
to load into the ListView. This made the app too clunky for the end
user.

Looked at various virtual listview suggestions but were all too complex
/ undocumented and didn't want to resort to 3rd party components.

Found that by calling ListView.BeginUpdate() before iterating through
the dataset and ListView.EndUpdate() afterwards, the load time went
down from 14 seconds to about 3.

Just wasted a good few hours on this one so thought I'd share it with
the group.


ETV
 
J

Jason Newell

It is also a good idea to use ListView.Items.AddRange() when add many items at one time.

Jason Newell, MCAD
Software Engineer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top