title: error textBox3 ACCESSED FROM A THREAD OTHER THAN THE THREAD IT WAS CREATED ON while executing Plinq query
body: <p>i have a method in another class that select all the lines that contains given char from textbox2,and print it to textbox3 on button_click but i'm having this error (textBox3 ACCESSED FROM A THREAD OTHER THAN THE THREAD IT WAS CREATED ON).</p>
  
  <pre><code>public void plinq()
      {
          List&lt;string&gt; lines = new List&lt;string&gt;(textBox2.Lines);
          List&lt;string&gt; lines2 = new List&lt;string&gt;();
          try
          {
              if (textBox3.InvokeRequired)
              {
                  textBox3.Invoke(new Action(plinq));
              }
              else
              {
                  lines.AsParallel().ForAll(K =&gt;
                  {
                      for (int i = 0; i &lt; K.Length; i++)
                      {
                          if (lines[i].Contains(textBox4.Text))
                          {
                              lines2.Add(lines[i]);
                          }  
                      }
                      textBox3.Lines = lines2.ToArray();
                  }); 
              }
          }
          catch (Exception e)
          {
              MessageBox.Show(e.ToString());
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Hgitj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hgitj.png" alt="enter image description here"></a></p>
  
  <p>and her is the code of the button where i am calling the method</p>
  
  <pre><code>        private void button6_Click(object sender, EventArgs e)
      {
          textBox3.Text = "";
          int n = Convert.ToInt32(textBox1.Text);
          worker = new Worker(n, textBox2, textBox3, textBox4);
          Thread thread = new Thread(worker.plinq);
          sw.Start();
          thread.Start();
          //worker.plinq();
          sw.Stop();
          button6.Text = Convert.ToString(sw.Elapsed);
          sw.Reset();
      }
  </code></pre>