473,382 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 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 2759
"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 catches its Closing event and cancels it if the...
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 the following code in the BeforeUpdate event of the...
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 method from the InitializeComponent() method of...
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 ....snip... It would make sense if Windows keeps doing...
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 sure he wants to close the form, because it...
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 observe is that if the cellvalidating issues a...
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 argument set to True? Protected Overrides Sub...
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 is the Cancel button. WHen the user clicks on...
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 one Closing routine he will not be asked again by...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.