title: Cross-Thread problem - filling FlowLayoutPanel in two instances of a class from a List<Button> in another class
body: <p>So my problem is as follows: I manages to invoke the filling of the flowLayoutPanel with Buttons, but they refuse to appear in both of the instances of the form. Process being I read in from a db through a SQL query, and fill a List with the results. I then get that list as an args for making them into buttons and store those buttons in an List. I then want to use this List to populate a FlowLayoutPanel in another class which I have made to instances of. Problem arises here where I can only seem to fill one of them at a time (second one that is called).</p>
  
  <p>The class that creates the instances:</p>
  
  <pre><code>public class Oppsett
  {
      KjokkenSkjerm screenOne;
      KjokkenSkjerm screenTwo;
      public StatusSkjerm customerScreen;
  
      List&lt;Button&gt; buttonArray = new List&lt;Button&gt;();
      System.Timers.Timer refreshTimer;
      Thread threadTo;
  
  
      int counter = 0;
      List&lt;Button&gt; sendArrayEn = new List&lt;Button&gt;();
      List&lt;Button&gt; sendArrayTo = new List&lt;Button&gt;();
  
      public Oppsett()
      {
          customerScreen = new StatusSkjerm();
          screenOne = new KjokkenSkjerm(customerScreen);
          screenTwo = new KjokkenSkjerm(customerScreen);
  
          screenOne.Show();
          screenTwo.Show();
          customerScreen.Show();
  
          refreshTimer = new System.Timers.Timer(4000);
          refreshTimer.Elapsed += OnTimedEvent;
          refreshTimer.AutoReset = true;
          refreshTimer.Enabled = true;
      }
  
      public void addBongAsBtn(List&lt;Bong&gt; bongl)
      {
          Bong bon = new Bong();
  
          for (int i = 0; i &lt; bongl.Count; i++)
          {
              Button nextBong = new Button();
              bon = bongl[i];
  
              nextBong.Text = bon.bongInfo[0][0].ToString();
              nextBong.Size = new Size(186, 186);
              nextBong.Tag = bon;
              nextBong.Click += selectedBong_ClickEvent;
  
              if (buttonArray.Count == 0)
              {
                  buttonArray.Add(nextBong);
              }
              else
              {
                  bool exists = false;
  
                  for (int j = 0; j &lt; buttonArray.Count(); j++)
                  {
                      Bong bb = (Bong)buttonArray[j].Tag;
                      if ((int)bb.bongInfo[0][0] == (int)bon.bongInfo[0][0]) 
                      {
                          exists = true;
                          break;
                      }
  
                  }
                  if (exists == false)
                  {
                      buttonArray.Add(nextBong);
                  }
              }
  
          }
  
          screenOne.popArray(buttonArray);
          screenTwo.popArray(buttonArray);
  
      }
  </code></pre>
  
  <p>Then the class KjokkenScreen that contains the popArray method:</p>
  
  <pre><code>public void popArray(List&lt;Button&gt; lb)
  {
      Thread newThread = new Thread(() =&gt;
      {
          this.BeginInvoke((Action)delegate ()
          {
              foreach (Button b in lb)
              {
                  bongPanel.Controls.Add(b);
              }            
           });                
      });
      newThread.Start();
  }
  </code></pre>