PLEASE: Treeview Variable into TreeView...

F

Frank Uray

Again Hi all

Does somebody has any idea for the following:
I am declaring a variable as MyOwnTreeview and
filling it up. Noew I would like to apply this
TreeView to a TreeView on a Form witch is also
declared as MyOwnTreeview.
How can I do this without unsing the clone Methode??

Best reagrds
Frank
 
J

Joe White

Why do you want to fill one treeview and then copy into another? Why not
just fill the treeview that you want to fill?
 
F

Frank Uray

Because I am loading the treeview async, to
keep my application free, because it takes some
time to fill my treeview.
It does not help to delegate the loading prozedure,
I have to fill up a variable and then later just
change the handle of all root nodes.
 
J

Joe White

But why are you populating a treeview in your secondary thread, when you
never intend to show that treeview? It's generally a bad idea to use a UI
control to store data in a non-UI thread. It gains you nothing (as you're
finding out) and it can restrict you unnecessarily.

You'd be better off creating your own data structure to hold the tree data,
populating that data structure from your secondary thread, and then doing a
final Control.Invoke() to copy that into the tree. This would have the
added benefit that you could, if desired, delay creation of nested tree
nodes until those nodes were expanded and visible (further improving speed
of that final Invoke() call).
 

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