title: Pause event before another event finish
body: <p>I have two Forms (Form1 and Form2). On Form1 is treeView control and bool variable YesNo and on Form2 is button.</p>
  <p>What I want to do is run treeView1_NodeMouseDoubleClick and then run Form2, click button on that Form2 and then set value variable YesNo to true.</p>
  <p>But I'm stuck because treeView1_NodeMouseDoubleClick keep running after Form2 is shown and I don't know how to stop until button1_Click event is finish.</p>
  <p>From code below I would like to get MessegeBox with text True on it.</p>
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
      public static bool YesNo { get; set; }
  
      private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
      {
          if (treeView1.SelectedNode.Text == &quot;GB&quot;)
          {
              Form2 f2 = new Form2();
              f2.Show();
  
              # how to stop this event until button1_Click is finish
  
              MessageBox.Show(YesNo.ToString());
          }
      }
  }
  
  public partial class Form2 : Form
  {
      public Form2()
      {
          InitializeComponent();
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          Form1.YesNo = true;            
      }
  }
  </code></pre>