title: Open one child form at a time
body: <p>I am currently developing stand alone application in c#, also I am new in c# so don't know all its features..</p>
  
  <p>In my application I am having one main form having MDIContainer property true.. In that main form I have created one menu through which one can open different child forms...</p>
  
  <p>The problem is if user clicks on menu item the form is being open as I have created its instance and shown it on click event. But if one child form is already open and user clicks on another then that also being open..</p>
  
  <p>In that case I want automatically close the previous child form..</p>
  
  <p>Below is sample code..</p>
  
  <pre><code>public void menu1_click(sender,e)
  {
    Dim objForm1 As New Form1()
    objForm1.ShowDialog()
  }
  </code></pre>
  
  <p>and for secode form,</p>
  
  <pre><code>public void menu2_click(sender,e)
  {
  Dim objForm2 As New Form2()
  objForm2.ShowDialog()
  }
  </code></pre>
  
  <p>so here both form can open at a time but i want previous one to close if new gets open.. one form at a time..</p>
  
  <p>Kindly ignore syntax and punctual mistakes as its just sample..
  Kindly suggest me the best way to do it!!!!</p>