By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Fastest/Most Efficient way to repopulate a listbox?

BigPapaN0z
P: 24
I'm looking for a little bit of input on this topic. The scenario is this: I have a textbox which, using the _Changed event, searches a simple string array filled with filenames for a partial match. The find/search routine works well, but the biggest drawback I'm finding is the speed at which it takes to repopulate the listbox for the results. I'm dealing with a LOT of data (10k-20k entries) and would like anyone's input on how I might be able to speed up execution. I've considered adding a timer in the _Changed event that will give the user time to type out the query before starting to repopulate (the first letter or two causes the program to temporarily freeze/pause, anything after that is fairly quick). I can post code if it's needed, but I'm not looking for a code answer, just thoughts and/or experiences from other programmers.

Thanks in advance!

BigPapaN0z

PS - Using VS2010 for anyone interested.
Nov 17 '12 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,382
I suppose the first question is why you would need a list to contain that many items. It seems unwieldy to use.

You could just populate the first 100 or so items and then have buttons to populate the next 100 if they need to do so.
Nov 17 '12 #2

BigPapaN0z
P: 24
That's a definite possibility. The list is for filenames that are searchable. I'm writing a very simple karaoke rotation utility that will launch a 3rd party karaoke viewer/player. I have over 30k files, so on the first population of the listbox (for general browsing) it tends to freeze for a few seconds.

For the time being, I have added a timer that resets every time the user types. Set it for 2 seconds, and when the timer ticks, it searches for whatever is in the search textbox and populates the listbox with the results (replacing the entire list of files available).
Nov 20 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.