Hoping you guys can help me out with this.
I have an application in .Net 2.0 that uses a TreeView control for navigation on a WinForm. The application uses a custom collection to store the data that I populate the TreeView with, these collections inherit from the BindingList<> class. When the form
loads it has to populate the TreeView with all the objects in the collection now this is fine up to about 5000 records but then it starts to get really slow. I spawn another thread that runs the TreeView population routine but problem is this thread has to
cross thread call to the UI thread to actually add objects to the TreeView which means the form becomes frozen until the TreeView routine is finished.
Question 1 - Is there a way to populate the TreeView in the background while the form is loading, and if not what would be the fastest way to populate the TreeView bearing in mind it has to iterate a collection with over 5000 objects in it.
Question 2 - Whats the fastest way to iterate the collection, when a user click a node in the TreeView it has to iterate the collection and move the BindingManager to that row, is there a quick way to find an object in a collection by examining
a property of that object, e.g find an object whos ID property matches a given ID value?
Any help on this matter would be greatly appreciated, although the client is unlikely to have more than 5000 records I would like my app to be able to handle vast amount of data, if it cant I will have to re-evaluate my navigation to use something else ![]()
-
-
Surely you can't see all 5000 nodes at once?
Why not just populate the top level nodes at startup, and then insert the child nodes on demand when their parent node is expanded.
Or find a virtual treeview control, so you don't need to insert items into it at all, just fetch the data on demand when a particular node needs to be redrawn. -
Well the 5000 records are all in one level
my heirachy is as follows
- SupplierStatus e.g Active, Onhold etc
- SupplierName (heres where the 5000 records appear)
most will be active so when active node is expanded i will have the same problem.
The user need to be able to see all 5000 at once because they can then scroll down the list and select the supplier they want.
Im now thinking this isnt possible with a TreeView I might try a listview instead, but the TreeView looks much better
-
I think this article may help answer some of your questions.
-
What you have is an interface that while great for people to scan, is useless for data management and scalable design no matter how you go about it.
What you should do is provide them with a quick search box that lets them type in part of the name that they're looking for and returns the results. Then only a subset is displayed and the more specific the fewer results they'll get.
Much more effective design. -
5000 suppliers in one list? sounds like horrible usability

-
GRiNSER wrote:5000 suppliers in one list? sounds like horrible usability

why? there is a search box also which they can type in a supplier name to find one. I can't see a better way of doing it, there is an alphabetical list of suppliers broken down by there status, with a search box for them to search for a supplier, what would be better than that?
Also thanks for the link to the article, I was doing something similar but was doing a couple of things wrong and that article sorted me out cheers.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.