title: How to press a button from another form using C#?
body: <p>I have 2 forms:</p>
  
  <ol>
  <li>Form1 that make a screenshot.</li>
  <li>Form2 that have 2 buttons to manipulate the screenshot created by form1.</li>
  </ol>
  
  <p>Form1 also have a "hidden" button that contain the method to save the screenshot.</p>
  
  <p>My questions:</p>
  
  <p>How can i click the form1's button from form2?
  and
  How can i check when the form1 is closed and then close form2 too?</p>
  
  <p>I've tried something like this but nothing happens when i click form2 save button:</p>
  
  <pre><code>var form = Form.ActiveForm as Form1;
  if (form != null)
  {
      form.button1.PerformClick();
  }
  </code></pre>