Thousands of Rows in a Listbox- Visual Basic 2010

digitaldrew

Well-known member
Joined
Nov 10, 2012
Messages
167
Programming Experience
Beginner
Hey everyone..I hope there are some VB experts around that may know the best way to handle thousands of rows in a listbox?

I'm using Visual Basic Express 2010 and am trying to download a zip file, unzip it, and load the text file into a listbox or textbox. I have the file downloaded and unzipped properly but when trying to load this many records the program takes forever.

I was reading that a JET database may do what I'm looking for but I'm curious if anyone has experience with another method? The idea is that this list will load (about 60-100K) records and then people will be able to filter the list. I need a good way to get this to load quickly and be able to filter quickly..

Any suggestions would be appreciated!
 
Make sure you .SuspendLayout before adding the rows, and .ResumeLayout after. It shouldn't normally take much time to update, but it will if you redraw the listbox with every entry.
 
How are you adding the items? Let me guess: one by one calling Add in a loop? If so, nope. Unless you have a good reason not to, you should simply bind the data. If you're determined not to do that then at least populate a list first and then add all the items in one go using AddRange.
 
Back
Top