title: Wait to get info from a popup form
body: <p>At initialization of a form (the main form), it calls another form to get a bunch of starting input, and then transfers a lot of information:</p>
  
  <pre><code>Form3 getup = new Form3();
  getup.Show();
  example = getup.example;
  </code></pre>
  
  <p>However, I need to wait for this new form information to be complete.</p>
  
  <pre><code>Form3 getup = new Form3();
  getup.Show();
  waitfordone();
  example = getup.example;
  </code></pre>
  
  <p>ATM, I've tried using while statements:</p>
  
  <pre><code>Form3 getup = new Form3();
  getup.Show();
  While(getup.visible=true)Console.WriteLine("waiting");
  example = getup.example;
  </code></pre>
  
  <p>But this causes a hang... that is to say, it runs, then freezes. I suspect this is because the while loop is eating all the processing. So, I tried making a new thread</p>
  
  <pre><code>Form3 getup = new Form3();
  Thread t = new Thread(getup.Show());
  t.start();
  While(getup.visible=false)Console.WriteLine("waiting"); // takes a little bit to open
  While(getup.visible=true)Console.WriteLine("waiting"); //waits for close
  example = getup.example;
  </code></pre>
  
  <p>But this also causes it to hang. Perhaps for the same reason. I have looked into autoresetevents. </p>
  
  <p>And I tried:</p>
  
  <pre><code>AutoResetEvent invisible = new AutoResetEvent(false);
  Form3 getup = new Form3();
  void setup_invisible(object sender, EventArgs e)
  {
      if (getup.Visible == false) invisible.Set();
  }
  public ... {
  getup.VisibilityChanged += new EventHandle(setup_Invisible);
  getup.show();
  invisible.WaitOne();
  ... }
  // and many other variations on this
  </code></pre>
  
  <p>but alas, it opens form3, closes it (because the thread is done?), and then hangs at <code>invisible.WaitOne();</code></p>
  
  <p>Can someone please explain how to do this, reading is only making me more confused.</p>