469,951 Members | 2,640 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

Populating Treeview

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
2 2494
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
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.

Similar topics

reply views Thread by N-Mayne | last post: by
1 post views Thread by naijacoder naijacoder | last post: by
reply views Thread by Erland | last post: by
2 posts views Thread by Steve Arndt | last post: by
2 posts views Thread by Maddy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.