title: vb.net - how to open the same form multiple times USING A SUB
body: <p>You probably think this is a duplicate of other questions about this. But it isn't</p>
  
  <p>I have seen several different questions about this but none of them answer this.</p>
  
  <p>I would to open a form multiple times USING A SUB. Where I pass in a <code>Form</code> and it creates a new instance of this form. However I keep having problems with the <code>Form</code> being disposed if I run it twice</p>
  
  <p>This is the sub that does not work:</p>
  
  <pre><code>Public Shared Sub OpenProgram(ByRef formToOpen As Form)
      Dim newApp As Form
      newApp = formToOpen
      Try
          newApp.Show()
          newApp.BringToFront()
      Catch ex As Exception
          MsgBox("Unable to open program :(")
      End Try
  End Sub
  </code></pre>
  
  <p>I have also tried <code>Dim newApp As New Form</code> and <br><code>Dim newApp As New formToOpen</code> however none of these work</p>
  
  <p>I only have the problem if I try and run the sub, then close the form, then run the sub again.</p>
  
  <p>The error I get is:</p>
  
  <blockquote>
    <p>Can not access a disposed object <br> Object Name: 'shop'</p>
  </blockquote>
  
  <p><code>shop</code> is just a form</p>
  
  <p>Thanks in advance</p>