I have multiple forms in my program. The menu form (frmMenu) contains buttons that will hide the menu form and show their corresponding form e.g. form frmXyl. Closing the form frmXyl should hide it and show the form frmMenu.
'Form frmMenu button click event
'Hide the form frmMenu
Me.Hide()
'Show the form frmXyl
frmXyl.Show()
'This is the form frmXyl form closing event
'Hide the form frmXyl
Me.Hide()
'Show the form frmMenu
frmMenu.Show()
I can start the program and click on the button to hide frmMenu and show frmXyl, then I can close frmXyl which hides frmXyl and show frmMenu.
Now, if I click the button to show frmXyl and hide frmMenu a second time I get an error.
Here is the error: An error occurred creating the form. See Exception.InnerException for details. The error is: COM object that has been separated from its underlying RCW cannot be used.
I have used show and hide with forms before without issue, thanks in advance of any solution you may have to this.