title: Access windows control from Backgroundworker DoWork
body: <p>my issue is the following:</p>
  
  <p>I have a windows form in which I've placed a LayoutPanel, when the forms Loads, multiple controls like: textboxes and labels are being added to the LayoutPanel.</p>
  
  <p>Then on a button click, I need to process the data entered by the user on those dynamically created controls. For that purpouse I use a Backgroundworker which is supposed to take those controls and read their data.</p>
  
  <p>My issue es that the Backgroundworker doesn't allows me to access the control from the DoWork Method, but I need to do it that way because I'll be reporting the progress of the operations.</p>
  
  <p>Here are portions of my code to clarify the concept:</p>
  
  <pre><code>private void frmMyForm_Load(object sender, EventArgs e)
      {
         //I add multiple controls, this one is just for example
         LayoutPanel1.add(TextBox1);
  
         ....
      }
  
  private void bgwBackground_DoWork(object sender, DoWorkEventArgs e)
      {
  
         foreach (Control controlOut in LayoutPanel1.Controls)
         {
             //do some stuff, this one is just for example
             string myString = controlOut.Name; //-&gt; Here is the error, cant access controls from different Thread.
         }
      }
  </code></pre>
  
  <p>Setting text is simple just using a delegate, but how about getting the entire parent control to manipulate the child controls (just for getting info, I don't want to set any data, just need to Get Name, Text, stuff like that).</p>
  
  <p>Hope I made myself clear, thank you all.</p>