Parent/Child error on open

amber

Member
Joined
Oct 27, 2004
Messages
20
Programming Experience
Beginner
Hello,

I have a parent form, with a menu item used to enter 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
 
you should have a global variable being the form

such as friend mychildform as childform

then when you open the child form have it make a new instance of the form

such as:
mychildform = new childform
mychildform.parent = me '(me being the parent form fyi)
mychildform.show
 
Yes but if you just did mychildform.show, closed it and then tried to use mychildform.show again youd get that error.
 
Back
Top