Can't get TreeView data out of the thread

I created a backgroundWorker in order to thread the creation of a treeView that shows the fileSystem.

I also created a recursive method that steps through the fileSystem and adds them to a specified treeView

I instansiate a new treeView when the thread starts and run the recursive method for that treeView. The data exists in that treeView (since I can acess it through the nodes) but for some reason I cannot copy the data to the original treeView in the main control.

Anyone have a solution to this





Answer this question

Can't get TreeView data out of the thread

  • UFAnders

    Hello.

    I would fill up the "treeView in the main control" from the background thread directly, using Form.Invoke() of course.

    Hope this helps



  • Exentrick1

    I tried that, but for some reason I couldn't figure out the invoking correctly.
    As far as I can tell you need a delagate and that just threw me for a loop with my recursion.

     I got it sorted tho, I added the treeView that I created in the thred to the form, using the layout values from the original, then just removed the original .... works no problem :)

    -Aequitas


  • Can't get TreeView data out of the thread