title: Freezing windows form c#
body: <p>I am trying to freeze the form while <code>LoadNewQCDetails();</code> method is on process; but, even though the UI is disabled/suspend after completing the <code>LoadNewQCDetails();</code> method, all click events by the user will trigger. So,
  I need to freeze the form such that the user can't click on anything in the UI till the <code>LoadNewQCDetails();</code> process completed.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>    private void button5_Click(object sender, EventArgs e)
      {
      //this.SuspendLayout();
      //this.Enabled = false;
      button3.Enabled = false;
      tabControl1.Enabled = false;
      groupBox1.Enabled = false;
      groupBox2.Enabled = false;
      groupBox3.Enabled = false;
  
      GlobalVariable.RefreshArtiCnt = 0;
  
      if (comboBox2.Text != "" )
      {
        //  LoadAllQCDetails();
  
          //this function takes nearly 1 minute to complete task
          LoadNewQCDetails();
      }
      else
      { MessageBox.Show("Data not found for this condition", "Alert"); }
  
  
  
      button3.Enabled = true;
      tabControl1.Enabled = true;
      groupBox1.Enabled = true;
      groupBox2.Enabled = true;
      groupBox3.Enabled = true;
  
      //this.Enabled = true;
      //   this.ResumeLayout();
  }
  </code></pre>