TreeView

J

Jeff Gaines

I need to show more that 1,000,000 nodes in a .Net forms tree view control
i dont think its a good idea to load the whole data at once in the tree
view
of course the data is load a from xml stream the load time is very fast
but dumping it onto the treeview dosent sound well
any better idea?!?!

i thought maybe to use treeview the way windows explorer (when you click +
sign beside a node that is actually a folder; the contents are read and
added to the treeview) but i dont how to get the tree view somthing like
that (of course i dont expect to accoplish it by changing a property value
or writting 1 or 2 line of code)
i dont have any idea what to do?
any helper class in .Net? appropriate event handler? any kind of data
binding to the tree view ? or ....


That's the way to do it - assuming your data fits into a parent/child type
relationship. Trap the expand event and load the children from there.

I have put an example of a file manager using this technique on the
CodeProject at:
http://www.codeproject.com/cs/files/JFileManager31.asp

if it's any help.
 
G

grant

Leon_Amirreza said:
I need to show more that 1,000,000 nodes in a .Net forms tree view control
i dont think its a good idea to load the whole data at once in the tree view
of course the data is load a from xml stream the load time is very fast but
dumping it onto the treeview dosent sound well
any better idea?!?!
You can add a dummy child TreeNode for each folder node that you add -
this will ensure that the + symbol is displayed. Then you can trap
the expand event, delete the dummy node and add the real child nodes.

This will only improve performance if you don't have a large number of
nodes under any one given node. If you have this sort of scenario
then you should take a look at Infralution's Virtual Tree. This is a
data driven control which is built from the ground up to only load the
data required to display the current tree display. If you have
1,000,000 nodes on one level (eg under the root) it will still only
load the 30 or so required to display the current tree view - resulting
in almost instantaneous loading and minimal memory overhead. You can
get more information and download an evaluation version from:

www.infralution.com/virtualtree.html

Regards
Grant Frisken
Infralution
 
L

Leon_Amirreza

I need to show more that 1,000,000 nodes in a .Net forms tree view control
i dont think its a good idea to load the whole data at once in the tree view
of course the data is load a from xml stream the load time is very fast but
dumping it onto the treeview dosent sound well
any better idea?!?!

i thought maybe to use treeview the way windows explorer (when you click +
sign beside a node that is actually a folder; the contents are read and
added to the treeview) but i dont how to get the tree view somthing like
that (of course i dont expect to accoplish it by changing a property value
or writting 1 or 2 line of code)
i dont have any idea what to do?
any helper class in .Net? appropriate event handler? any kind of data
binding to the tree view ? or ....
 
G

Grant

Leon_Amirreza said:
I have thought of the dummy node the get + appear its good trick
I was wondering if there is more .Net like way to do it.

I think this is the best you can do without completely rewriting the
treeview control
and the number of the child nodes may vary so the better idea is
the virtual tree since there are still chances that the number of child
nodes of some nodes be around 40,000 or more but the total can be even more
than 1,000,000
of course having 1,000,000 as a child of root node is impractical but not
impossible

AND Most importantly the link brings up the "Page Can not be displayed"
i don know if anything went wrong or just the link is broken?!

I just checked the link and it seems OK. If it is still not working
for you please let us know - what country are you coming from?
 
L

Leon_Amirreza

I have thought of the dummy node the get + appear its good trick
I was wondering if there is more .Net like way to do it.

and the number of the child nodes may vary so the better idea is
the virtual tree since there are still chances that the number of child
nodes of some nodes be around 40,000 or more but the total can be even more
than 1,000,000
of course having 1,000,000 as a child of root node is impractical but not
impossible

AND Most importantly the link brings up the "Page Can not be displayed"
i don know if anything went wrong or just the link is broken?!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top