472,344 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,344 software developers and data experts.

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

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
3 2664
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ron L | last post by:
I have an MDI application which opens a number of child windows, each of which could have data in a state that needs to be saved. Each child window...
2
by: Corrine | last post by:
Is there a way to cancel a change in an option group? The option group still changes to the option clicked on when clicking on the NO button with...
6
by: Carl | last post by:
Hi you al I am new to this stuff and I found this code to close a form in the help files and I do not understand it or where its goe ' Calls this...
2
by: Just Me | last post by:
I've seen this in example code: Private Sub Studio_Closing(ByVal sender A..snip.. Handles MyBase.Closing If e.Cancel Then Exit Sub ...
3
by: Oenone | last post by:
I'm writing an application with various MDI child forms. In the Closing event of many of the forms, I have code that asks the user whether he is...
2
by: Bob | last post by:
In a winform with a datagridview using cellvalidating event but also have a save button that is located on a tablebindignnavigator. The behaviour I...
1
by: Phill W. | last post by:
Has any come across a situation where, in a Form-derived .. er .. Form, the Event Arguments passed to OnClosing /already/ have their Cancel...
21
by: Darin | last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to handle textbox.validating, and I have the form setup so the Cancel button...
4
by: Academic | last post by:
Does it make sense to put this If e.Cancel Then Exit Sub at the beginning of form closing events so if the user cancels the app's exiting in...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.