Closed event not getting called?

Y

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
 
C

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top