title: Update GUI from a non-GUI-Thread -> Not working with BeginInvoke()
body: <p>I have created a simple WindowsForms-Application with one <code>button</code> and one <code>label</code>.
  If I click the button then the label should display the numbers from 1 to 100000.</p>
  
  <p>But if I click the <code>button</code> then the <code>GUI</code> freezes till the program counted to 100000 and then the label displays 100000 and the GUI stops freezing.</p>
  
  <p>The counting from 1 to 100000 is executed in a new thread (not the GUI thread) and then changing of the <code>labeltext</code> I try with <code>BeginInvoke</code>, but it don't works...</p>
  
  <pre><code>using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace WindowsFormsApplication1 {
      public partial class Form1 : Form {
          public Form1() {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e) {
  
              new Thread(DoSomethingExpensive).Start();
  
          }
  
          void DoSomethingExpensive() {
  
              for (int i = 0; i &lt; 100000; i++) {
                  this.label1.BeginInvoke((Action)(() =&gt; {
                      label1.Text = "" + i;
                      }
                      ));
              }
  
          }
  
      }
  }
  </code></pre>