Populating Treeview

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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,
 
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.
 
Back
Top