By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,882 Members | 2,482 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,882 IT Pros & Developers. It's quick & easy.

Why is e.Cancel set to True on Entry to Closing Event?

P: n/a
Under what circumstances would e.Cancel be set to True on entry to the
Closing event of an MDI child form?

I have found that this is why my application won't close properly. I can
explicitly set the value to False, but I would have expected it to be False
on entry.

TIA

Charles
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Charles Law" <bl***@nowhere.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Under what circumstances would e.Cancel be set to True on entry to the
Closing event of an MDI child form?

I have found that this is why my application won't close properly. I can
explicitly set the value to False, but I would have expected it to be False on entry.

TIA

Charles


If a control has CausesValidation set to True, and in its Validating event
it sets e.Cancel to True, you will see this. MS calls this inability to
close the form "by design".

Best Regards,
Andy
Nov 20 '05 #2

P: n/a
Hi Andy

Thanks for the response.

I haven't deliberately implemented any Validating event, but I will,
nevertheless, check this out as a possible cause.

Cheers.

Charles
"Andy Becker" <x@x.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Charles Law" <bl***@nowhere.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Under what circumstances would e.Cancel be set to True on entry to the
Closing event of an MDI child form?

I have found that this is why my application won't close properly. I can
explicitly set the value to False, but I would have expected it to be

False
on entry.

TIA

Charles


If a control has CausesValidation set to True, and in its Validating event
it sets e.Cancel to True, you will see this. MS calls this inability to
close the form "by design".

Best Regards,
Andy

Nov 20 '05 #3

P: n/a
I have investigated this further, and can confirm that I have not
implemented any Validating event code.

So, I am still left with the same question: What would cause e.Cancel to be
True on entry to the Closing event of an MDI child form.

As I stated before, I can set this to False on exit from the event, but that
only works when there is a child form open.

What seems to happen is that when there is no child form open, I cannot
close my app because Cancel is set to True - for some reason - and there is
no child form Closing event for me to set it False.

The scenario is this:

I start my app, which opens an MDI form.
I open an MDI child form and drag some user controls onto it.
I close the MDI child form.
The Closing event fires and e.Cancel is False on entry
I open another child form and drag some user controls onto it
I click the close button on the MDI _parent_ form
The Closing event fires for the MDI child form and e.Cancel is *True* on
entry

Can anyone suggest what could cause e.Cancel to be True in this situation?

This is a particular problem when I close the second MDI child form with its
close button. Then there are no child forms open, and when I click the close
button for the MDI parent form nothing happens. The form will not close,
because (I suspect) that it has Cancel set to True internally, and therefore
abandons the close immediately.

Charles
"Charles Law" <bl***@nowhere.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Under what circumstances would e.Cancel be set to True on entry to the
Closing event of an MDI child form?

I have found that this is why my application won't close properly. I can
explicitly set the value to False, but I would have expected it to be False on entry.

TIA

Charles

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.