title: How to bring MDI Child Form To Front?
body: <p><strong>Overview:</strong></p>
  
  <p>I have an MDI Parent Form in which I load other forms. After loading the second form, I can no longer bring the first one to the front.</p>
  
  <p><strong>Description:</strong></p>
  
  <p>On the parent form I have a menu strip containing 2 menu items; Home and Search.
  Each click event loads their corresponding form unless said form is already loaded.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p><strong>a.</strong> Click Search. Then click Home.</p>
  
  <p><strong>b.</strong> If Search is once again clicked, it no longer brings its corresponding, already opened form to the front.</p>
  
  <pre><code>    private void tsmHome_Click(object sender, EventArgs e)
      {
          // Loop through all open forms...
          foreach (Form form in Application.OpenForms)
          {
              // If frmHome is Opened, set focus to it and exit subroutine.
              if (form.GetType() == typeof(frmSearch))
              {
  
                  form.Activate();
                  return;
              }
          }
  
          // If frmHome is not Opened, create it. 
          frmHome f = new frmHome();
          f.MdiParent = this;
          f.Show();
      }
  
      private void tsmSearch_Click(object sender, EventArgs e)
      {
          // Loop through all open forms...
          foreach (Form form in Application.OpenForms)
          {
              // If frmSearch is Opened, set focus to it and exit subroutine.
              if (form.GetType() == typeof(frmSearch))
              {
  
                  form.Activate();
                  return;
              }
          }
  
          // If frmSearch is not Opened, create it. 
          frmSearch f = new frmSearch();
          f.MdiParent = this;
          f.Show();
      }
  </code></pre>