Can this.Dispose() be called from within a form?

  • Thread starter Thread starter Roberto Rocco
  • Start date Start date
R

Roberto Rocco

Hello,

If I want to dispose a form, is it absolutely necessary to do it from "outside" the form like this:

MyForm frm = new MyForm();
frm.ShowDialog();
frm.Dispose();

or can it be done inside the form?
I already tried to call this.Dispose() from the MyForm_Closed() event, but I'm getting the following error message:

"An unhandled exception of type 'System.ObjectDisposedException' occurred in System.Windows.Forms.dll"

(I'm using CF 1.0 SP3)

Is there a better place to call Dispose() or is it simply not possible to do it from within the form?

Many thanks in advance,

Roberto Rocco.
 
Back
Top