Treeview - How do I improve efficiency adding 10000+ nodes
Treeview - How do I improve efficiency adding 10000+ nodes
(OP)
I have an application that creates a TreeView of Data pulled from a DB2 ADO.Recordset
I select over 13,000 records, which can create up to 4 levels.
I currently do a: Do while Loop for each nextrecord
treeview.nodes.add (Key1, child, Key2, Data1)
This process takes 5 minutes to load.
Is there a way I can write this to speed up the load time.
Thanks
I select over 13,000 records, which can create up to 4 levels.
I currently do a: Do while Loop for each nextrecord
treeview.nodes.add (Key1, child, Key2, Data1)
This process takes 5 minutes to load.
Is there a way I can write this to speed up the load time.
Thanks
RE: Treeview - How do I improve efficiency adding 10000+ nodes
I can see two answers to your question.
1) Don't load the sub-trees until the user clicks on the [+] symbol. This is obviously difficult to code, but is the way that Windows Explorer works.
2) There is an API call named LockWindowUpdate.
BOOL LockWindowUpdate(
HWND hWndLock // handle of window to lock
);
Call this with the windows handle of your treeview control before loading it up with data. Afterwards call it with a NULL to unlock it. What it does is defer the painting in the window.
Chip H.
RE: Treeview - How do I improve efficiency adding 10000+ nodes