I’m wondering how I can open again the closed form from using this.Close(). Every time I’m trying to open the closed form using Mainmenu.Show(), the exception throws an error “cannot access the disposed object. Object name: Mainmenu”.
How can I open it again?
When the
Closemethod is called on aFormyou cannot call theShowmethod to make the form visible, because the form’s resources have already been released akaDisposed. To hide a form and then make it visible, use the Control.Hide method.from MSDN
If you want to re-open a form that has been closed, you need to re-create it again the same way you created-it at first: