title: C# Method Statements Not executing in correct order
body: <p>I seem to have  a problem executing commands in the correct order, I have a method in my Program:</p>
  
  <pre><code>private void  GenerateButton_Click(object sender, EventArgs e)
  {
      Statuslabel.Text = "Working...";
  
      LongMethod();
      //Call to another Method of another class which takes 15-20 seconds to execute
  
      Statuslabel.Text = "Done";
  }
  </code></pre>
  
  <p>the problem seems to be that instead of assigning "Working" to the status label and THEN calling the <code>LongMethod</code>, the Program seems to execute <code>LongMethod()</code> first, and then it changes Status Label's text to "Working" for a split second and then immediately changes it to "Done".
  Oh, and the UI is locked up during the <code>LongMethod()</code> execution, because the Program is SingleThreaded.</p>
  
  <p>I tried  threads earlier, but for the life of me I couldn't get the syntax right, I tried:</p>
  
  <pre><code>Thread MyThread = new Thread(LongClass.LongFunction);
  
  Thread MyThread = new Thread(new ThreadStart(LongClass.LongFunction));
  </code></pre>
  
  <p>Where <code>LongClass</code> is the class which contains <code>LongFunction</code> as a static method.
  I will check out the background worker now.</p>