×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Treeview - How do I improve efficiency adding 10000+ nodes

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

RE: Treeview - How do I improve efficiency adding 10000+ nodes

Hi Smiz!

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

I'd go with the first choice. There is no way your users could 13,000 records in one go on screen, why load them? Also, what if they just want to look at the first item? They will have to wait for the other 12,999 item to load first! It is harder to code, but the percieved and actual performance gain is imesurable. If you'de like an example of how to populate a treeview, mail me and I'll get one to you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close