ListView and performance

  • Thread starter Thread starter Troy Hilbert
  • Start date Start date
T

Troy Hilbert

Here's the deal.

I've got a class which is the root of an object hierarchy. Within this
class I create a private member variable of type Form. In the form class, I
have created a public LoadFile method that reads a text file (960 KB),
creates an array of ListViewItems(~33,000) based on the file and the I add
those items to the ListView via the AddRange method.

I instantiate the form from the root class, no problem.

I call the LoadFile method, although it measures out to ~1.5 seconds, still
no problem (I execute this method from the root class as a new thread, btw)

Back in the root class, I call Form.Show(), big problem. It takes 25
seconds to simply display the form!??!?!!!!? This HAS to do with the
ListView.

Anyone have a tip or suggestion as to how to improve the display speed of
this form?

Best

Troy
 
Hello,

Troy Hilbert said:
I've got a class which is the root of an object hierarchy.
Within this class I create a private member variable of
type Form. In the form class, I have created a public
LoadFile method that reads a text file (960 KB),
creates an array of ListViewItems(~33,000) based on the

You may want to use a virtual listview:

http://www.vbcity.com/forums/topic.asp?tid=13777

Regards,
Herfried K. Wagner
 
Thanks for the suggestion, but I don't think I am at the point where I want
to use non-standard methods to solve the problem. It's always an option
though. I was hoping to find a quick solution. As I said earlier, I fill
the listview very quickly, it's displaying the form that takes all the time.

Best
 
Another good idea. I really think that I want to display them all due to
the nature of the information (it's a list of news groups). I've tried
several aproaches and think I've found an acceptable (not optimal) level of
performance. The main problem I was having was that the user interface was
unresponsive while I was adding the items. The solution I came up with was
to create a function to wrap the population of the ListView and then create
a new thread to run that function. Viola, the UI became responsive. I've
got it to the point where I can open the file, read all the items,
instantiate an array of type ListViewItem and populate the ListView with
36000 items (no sub items) in ~15-20 seconds.

Thanks for your suggestions.

Best
 
Back
Top