Home All Groups Group Topic Archive Search About

Closed event not getting called?

Author
27 Feb 2006 7:01 PM
YYZ
I've got a form in my application.  From this form, I showdialog
another form, like this:

dim f as new frmWhatever
f.someprop = somevalue
f.showdialog()
f.OkToClose = True
f.close
f = nothing

On the dialog type form, I have a property called OkToClose.  If the
user closes the dialog form by using the control menu, then in the
form.Closing event, I have this:

if OkToClose = False then
    e.cancel = true
    me.hide
    exit sub
end if

So, the form doesn't get Closed when the user "closes" it -- it gets
Closed when my code on the parent form sets OkToClose = True and then
calls f.Close.

I have code in the frmWhatever.Close event, and it NEVER gets called,
as far as I can tell.  Is there a reason for this?  Am I missing
something?

Matt

Author
27 Feb 2006 10:51 PM
Chris Dunaway
Be sure that when you are done with the form, that you call it's
Dispose method. That is not automatically called when you close it,
unlike a form shown with just the Show method.