App responsiveness during loop
I have designed an app in vb.net 2005 that at one point adds and loops over about 500k list in listbox about.
When adding these items to the listbox, the app freezes for about 5-10 minutes, then when looping over the items, processing them, the app also freezes for the same开发者_运维技巧 time. Am loading the data from a text file
- How can I make my application responsive during loops?
- should I use a queue to process the list?
- what is the messagequeue control for?
I recommend you to use BackgroundWorker. Store items in array, and bind listbox to it. Working with array will be much faster then with listbox'es collection.
Or you can call BeginUpdate/EndUpdate before/after adding new items.
精彩评论