Hiding all open forms
<p>I have three forms.</p>

<p>Lets say A, B, C.</p>

<p>Form A opens form B and form B then opens form C.</p>

<p>I have added button <strong>Hide all open forms</strong> in form C.</p>

<p>Now how do I hide all three forms with this button ?</p>

<p>I know one way is using ShowWindow Api, but I don't want to use Api calls.</p>

<p><strong>Edit :</strong>  Thanks to <a href="http://stackoverflow.com/users/166452/somos">SoMoS</a>.</p>

<pre><code>for (int i = Application.OpenForms.Count - 1; i &gt;= 0; i += -1)
{
     if (!object.ReferenceEquals(Application.OpenForms[i], this))
     {
          Application.OpenForms[i].Hide();
     }
}
this.Hide();
</code></pre>

<p>Or</p>

<p>In form A (thanks to <a href="http://stackoverflow.com/users/306651/ho1">ho1</a>)  </p>

<pre><code>B frm = new B();
frm.Owner = this;
frm.Show();
</code></pre>

<p>In form B</p>

<pre><code>C frm = new C();
frm.Owner = this;
frm.Show();
</code></pre>

<p>In form C's button click event.</p>

<pre><code>Owner.Owner.Hide();
Owner.Hide();
Hide();
</code></pre>

<p>Or thanks to <a href="http://stackoverflow.com/users/52626/wim-coenen">Wim Coenen</a></p>

<pre><code>foreach (Form var in Application.OpenForms)
{
     var.Hide();
}
</code></pre>

<p>Thanks.</p>
