473,835 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView performance

Joe
I'm loading a TreeView with ~8900 root nodes and only a couple of child
nodes giving a total of 8910 nodes.

It takes several seconds for the tree to display. The method that populates
the tree returns in < .5 seconds.

Populating the tree in the Load event takes even longer than clicking a
button after the screen has been loaded.

try
{
treeView1.Begin Update();

foreach (DataRow dr in mytable.Rows)
treeView1.Nodes .Add(dr[mycol].ToString());

}
finally
{
treeView.EndUpd ate();
}

Is there an Allocate method or property I can call or set before loading to
possibly speed it up?
Another thing worth mentioning is that the screen also takes ~1.5 - 2
seconds to close when the tree is loaded.

If I don't load the tree the screen opens and closes immediately.
Nov 17 '05 #1
2 5406
IMHO, 8900 nodes are too many from the usability perspective, some previous
filtering should be required. If really that amount is needed, some common
controls support a technique called "Virtual XXX", based on owner-draw. Here
you have a sample of Virtual Listview to show what I mean:

http://msdn.microsoft.com/library/de...smpvlistvw.asp

Maybe there is also a sample of virtual treeview in the MSDN Library, not
sure.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
"Joe" <J_no_spam@_no_ spam_Fishinbrai n.com> escribió en el mensaje
news:e8******** ******@TK2MSFTN GP09.phx.gbl...
I'm loading a TreeView with ~8900 root nodes and only a couple of child
nodes giving a total of 8910 nodes.

It takes several seconds for the tree to display. The method that
populates the tree returns in < .5 seconds.

Populating the tree in the Load event takes even longer than clicking a
button after the screen has been loaded.

try
{
treeView1.Begin Update();

foreach (DataRow dr in mytable.Rows)
treeView1.Nodes .Add(dr[mycol].ToString());

}
finally
{
treeView.EndUpd ate();
}

Is there an Allocate method or property I can call or set before loading
to possibly speed it up?
Another thing worth mentioning is that the screen also takes ~1.5 - 2
seconds to close when the tree is loaded.

If I don't load the tree the screen opens and closes immediately.

Nov 17 '05 #2
The standard TreeView (and most commercial) TreeView controls will have
real performance issues once you get start getting that many root
nodes. If have a large number of nodes spread fairly evenly you can
improve performance with the standard TreeView by loading the child
nodes when the user clicks the expand icon (you have to add a dummy
node first so that the expand icon is displayed).

If you are willing to consider a commercial solution then Infralution's
VirtualTree would provide the performance you are seeking. The tree
loads almost instantly regardles of the number of root nodes (or total
tree size) because it loads data on demand ie as it is required for the
current display.

You can find a fully functional demo at:

www.infralution.com/virtualtree.html

Regards
Grant Frisken
Infralution
Joe wrote:
I'm loading a TreeView with ~8900 root nodes and only a couple of child
nodes giving a total of 8910 nodes.

It takes several seconds for the tree to display. The method that populates
the tree returns in < .5 seconds.

Populating the tree in the Load event takes even longer than clicking a
button after the screen has been loaded.

try
{
treeView1.Begin Update();

foreach (DataRow dr in mytable.Rows)
treeView1.Nodes .Add(dr[mycol].ToString());

}
finally
{
treeView.EndUpd ate();
}

Is there an Allocate method or property I can call or set before loading to
possibly speed it up?
Another thing worth mentioning is that the screen also takes ~1.5 - 2
seconds to close when the tree is loaded.

If I don't load the tree the screen opens and closes immediately.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1743
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an hierarchical view of Parent Nodes and projects where in a projectnode can be added to any ParentNode and hence we may have a project node added to 100 Parent nodes. In this one, I have an operation of Renaming a Project Node. So whenever I am doing the...
4
2250
by: Aidan Marcuss | last post by:
I am seeing significant performance problems with the TreeView (from the Microsoft.Web.UI.WebControls namespace) when trying to data bind it on the server side. I set the TreeNodeSrc property and the TreeNodeTypeSrc property and then call the DataBind() method. I am setting each of these properties to a string of XML. As the payload grows, this becomes terribly slow. This is all server side. I've found that this may have to do with...
77
14458
by: Tark Siala | last post by:
hi i working with TreeView in VB6, and have good Properity Named (Key) with the Key i can goto Any Node i know hes Key. but in VB.NET i can find the Key :( please tell me where i can find the key in TreeView.Net... ----------------------------------------------- Best Regards From Tark
8
4644
by: Shawn B. | last post by:
Greetings, I'm creating a little program that acts as a glorified Registry explorer. The TreeView doesn't allow you to show a plus sign unless a node has child nodes, so I need to determine whether a registry key has subkeys and add a dummy childnode. The way I'm doing this is to populate the child nodes as the parent is expanded. However, there are some serious performance implications. First, when I pouplate the HKEY_CLASSES_ROOT,...
7
9703
by: tman | last post by:
I am generating a very large tree list in my program and while it's performance is great once loaded it takes a really long time to load. I create a root TreeNode "offline" and go through the process of creating building up the tree from there. Only when I am done do I go over to the actual TreeView object on my form and add the my root to the TreeView. This sinlge step when I add my constructed root node to the form's TreeView control...
6
3243
by: Christof Nordiek | last post by:
Hi all, in my WinForm-Application i have a strange problem with the TreeView Control. As you can see in the samplecode below, i fill the TreeView by adding some nodes with sub nodes. (The subnodes don't matter in the first place.) After that, when i scroll totally to the bottom, the last item (the 9) rest almost totally invisable. This problem disappears, when i open (and close) one of the nodes. (The sample code uses subnodes only to...
0
1584
by: uncensored | last post by:
Hi, Sort of new with the whole treeview control and I was wondering is there a way to build a treeview menu using my SQL data I pull from a database instead of having to hard code it into the webpage. Pasted below is my current code but what I would like to do is instead make a table in SQL that data can be added or modified to and have it generate the menu according to the data instead. Thanks for the help, Mike <mytree:treeview...
2
1778
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
Now we have to load the whole company's organizational relationships into one TreeView which has at lest 6~7 layer and including 300~400 nodes.In every node,there is a checkbox. So we need following cascade selected effect: 1. Every time we select one node,all his child nodes' state will be changed into selected automatically(if this node has child node). 2 . Every time we select one node,his father nodes' state will be be changed
2
5245
by: =?Utf-8?B?QU5V?= | last post by:
I have a tree view which i load completely at the time of my webpage load. When i click on the + signs of the parent nodes, it expands to show all of its children. Similarly, when i click on the node itself, it expands to show its children. It works fine but it is very slow as compared to clicking on + sign to load children. No other event or process runs in the background when i click on the node or the + sign of the folder image. In my...
0
9652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10523
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10233
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7766
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5636
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5804
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.