How to add object in treeview from another thread
<p>I have a multithreading app, and I need to add object from another thread to the treeview. But I keep getting an exception </p>

<blockquote>
  <p>Action being performed on this control is being called from the wrong thread. Marshal to the correct thread using Control.Invoke or Control.BeginInvoke to perform this action.</p>
</blockquote>

<p>Here is my code</p>

<pre><code>ThreadPool.QueueUserWorkItem(new WaitCallback(GetFiles), entryPoint);

private void GetFiles(object entryPoint) 
{ 
      var localData = entryPoint as EntryPoint; 
      this.GetFiles(localData.DirectoryInfo, localData.TreeNode); 
      localData.ManualEvent.Set(); 
}

private void GetFiles(DirectoryInfo directory, TreeNode tree) 
{ 
    for (int i = 0; i &lt; allFiles.GetLength(0); i++) 
    { 
        tree.Nodes.Add(allFiles[i].Name);
    }
}
</code></pre>