By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Populating Treeview

P: n/a
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

Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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,
--
Dincer Ozturan

"Janus" wrote:
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

Nov 16 '05 #2

P: n/a
Yes, a good idea..
--
Dincer Ozturan
"C Addison Ritchie" wrote:
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.

--
C Addison Ritchie, MCSD
Ritch Consulting, Inc.
"Dincer Ozturan" wrote:
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,
--
Dincer Ozturan

"Janus" wrote:
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

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.