Re: Problem (dispose?) MDI forms



I don't call the close myselft. It's done by the tabbedMDI interface from
Janus (www.janusys.com). It looks like a tab where eveyry form is represented
on a seperate tabpage.

I don't think it's related to them, because I use these controls in a number
of projects and it don't have similar problems. It looks like in this case
the notification to the mdiparent gets lost...


"VJ" wrote:

Very tricky. I truly agree. Have developed MDI apps for last few years as
programmer. I don't like solutions like these, but sometimes after close
you can just set the object to null.

One thing tho'.. if you tabbed MDI, how is a child Form in a tab?, and you
do frm.Close().. and I am assuming you remove the Tab. Just curious on those
steps..!

VJ

"SealedClassSingleton" <Eagle@xxxxxxxxxxxxxxxx> wrote in message
news:FDADA37E-82F9-44D8-B3BB-9A28CCF86761@xxxxxxxxxxxxxxxx
I agree that closing a form doens't mean that the form is immediate
released,
but the problem is a little more subtile: I'm sure that the form is
disposed
(I put some code in the destructor), but it remains accessible through the
mdilist and in the midichildren property. As far as I know, no addtional
child are created inside the form (I additionaly even check if all
controls
are removed...)

I agree, that it could take a while to be GCed (depending on memory
consumption / load and other things) but once a form is closed it
shouldn't
be accessible anymore (In my situation is even worde bacause I'm using a
tabbed mdi interface and the users stills sees the "closed" window in the
MDI
tab. Clicking on it generates the exception)...

"VJ" wrote:

Sure.. Close does not mean the object is immediately available to be
garbage
collected and disposed. There is still other objects created by child
Form2
in memory, as long as all of it are not cleared Form2 will exist. Now
these
are not limited to Child form controls, they can be threads or any other
objects created when Form2 i.e. child was in memory and working...

HTH
VJ
"SealedClassSingleton" <Eagle@xxxxxxxxxxxxxxxx> wrote in message
news:3238DC52-45DD-4B33-93F0-DA6A19AAAEA0@xxxxxxxxxxxxxxxx
Hi,

I've a very weird error in an MDI application. From time to time, when
closing a child form, the form is closed correctly (put some writelines
on
different places: form_closing / form_closed / dispose) but is not
removed
from the MDIparent.

When I iterate over all child forms I can close the form a second time
(?)
even all controls are already disposed.

When clicking on the "closed" form in the MDI list, I get an
ObjectDisposed
Exception.

A first chance exception of type 'System.ObjectDisposedException'
occurred
in System.Windows.Forms.dll
System.ObjectDisposedException: Cannot access a disposed object.

Anyone who had similar problems ? Suggestions ?






.



Relevant Pages

  • Re: Best way to have a tabbed MDI application
    ... using the tab control, I've used a toolbar and a panel. ... I'm presuming that you are not using mdi forms in the same way as word - ie ... > will contain a tab page for each open MDI child form. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Best way to have a tabbed MDI application
    ... Use the tab control, ... then instantiate each form setting its parent to the tab page. ... > based system into .Net with a MDI interface. ... > will contain a tab page for each open MDI child form. ...
    (microsoft.public.dotnet.languages.vb)
  • Best way to have a tabbed MDI application
    ... based system into .Net with a MDI interface. ... will contain a tab page for each open MDI child form. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Best way to have a tabbed MDI application
    ... Imaging that are using word and instead of that it is a MDI application as ... To give an exact answer, it is in my opinion a MDI or a Tab page, not both. ... > will contain a tab page for each open MDI child form. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Weird Problem: Closing MDI Parent re-directed to MDI Child
    ... I see now why it goes to the child forms first. ... At the MDI form level I handle the Form.Closed event. ... Opening the child form loads some user controls and adds event handlers to ... > I would expect when you close the MDI parent that it will be re-directed ...
    (microsoft.public.dotnet.languages.vb)