Populating Treeview

G

Guest

Hello.

I need a little advice for populating the treeview control.

I dont want my application to hang while populating the treeview, there is a lot of data what's the best approach?

Maybe something eventbased but how? please help...

Should I avoid populating the treeview control using a thread?

And for something more general what's the best way to populate different controls - is it a sin to thread it? or ?


Kind regards
 
G

Guest

Hi Janus,
Try just to populate the collapsed parent nodes, not all of the child nodes. While doing that rather than quering db in every Expand, fetch all data you need from db during load of your form and when TreeView Expand event occurs just create controls (treenodes) by quering disconnected dataset in memory..
Good Luck,
 
G

Guest

Yes, a good idea..
--
Dincer Ozturan


C Addison Ritchie said:
Combine Dincer's suggestions with some ansynchronous data loading may be helpful too.

Do what Dincer said but for loading the parent nodes of the treeview use a DataReader that returns just these parent nodes. In the background use an asynchronous call to load the entire DataSet as suggested.

Could work maybe.
 

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