Parent/Child error message on open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a parent form, with a menu item used to open the child form.
If I open the child form, then close it, and try to reopen it from the
parent, I get the error message:

An unhandled exception of type 'System.ObjectDisposedException' occurred in
system.windows.forms.dll

Additional information: Cannot access a disposed object named "frm1".

What is causing this?

Thanks,
Amber
 
I'm guessing that when the form is closed, it is automatically disposed. You
may want to create a new instance of the form everytime the MenuItem's Click
event is called, or use a try, catch structure to recreate it if is disposed.
Good luck.
 
Back
Top