Re: Problem (dispose?) MDI forms

Tech-Archive recommends: Speed Up your PC by fixing your registry



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: multiple form toggle
    ... > Each child form receives user input and calculates these ... Public properties) to cache the data for each form. ... Add a textbox to Form2. ... Private Sub Form_Click ...
    (microsoft.public.vb.controls)
  • Re: how to call a form from a thread
    ... > I can call form2 from main thread but when i create a child ... > Dim frm as new form2 ... Multithreading in Visual Basic .NET ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: A question of size.. size matters :)
    ... > Form1 which is an MDI form ... > Form2 whcih is an MDI child ... form2 is the grunt of the app. ... some grunt task.. ...
    (borland.public.delphi.non-technical)
  • Re: Opening child from child within parent
    ... Assuming from your code that Form3 is a child from Form1 do you need to open ... You have first to find the index of your form3 in form2 ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem (dispose?) MDI forms
    ... Have developed MDI apps for last few years as ... child are created inside the form (I additionaly even check if all ... that it could take a while to be GCed (depending on memory ... as long as all of it are not cleared Form2 will exist. ...
    (microsoft.public.dotnet.framework.windowsforms)