PLEASE: Treeview Variable into TreeView...

  • Thread starter Thread starter Frank Uray
  • Start date Start date
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
 
Why do you want to fill one treeview and then copy into another? Why not
just fill the treeview that you want to fill?
 
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.
 
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).
 
Back
Top