473,883 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does e.CloseReason work for you?

Protected Overrides Sub OnFormClosing(B yVal e As
System.Windows. Forms.FormClosi ngEventArgs)

MyBase.OnFormCl osing(e)

Console.WriteLi ne(e.CloseReaso n.ToString )

always writes

UserClosing

No matter if I'm closing the form, exiting the app, shutting down windows or
using the Task Manager to shut down the app.

Does e.CloseReason work for you?

Thanks


Dec 8 '07 #1
2 3890
Sorry, I think I got it figured.

This is a Mdi app but some forms are not children.

I close these from the Mdi FormClosing event so I guess they see that reason
instead of the fact that the app is exiting.
"Academia" <ac************ @a-znet.comwrote in message
news:Oi******** ******@TK2MSFTN GP06.phx.gbl...
Protected Overrides Sub OnFormClosing(B yVal e As
System.Windows. Forms.FormClosi ngEventArgs)

MyBase.OnFormCl osing(e)

Console.WriteLi ne(e.CloseReaso n.ToString )

always writes

UserClosing

No matter if I'm closing the form, exiting the app, shutting down windows
or using the Task Manager to shut down the app.

Does e.CloseReason work for you?

Thanks




Dec 9 '07 #2
Seems to be that the only time I get other than UserClosing is when a Mdi
child is closing.

Not when the Mdi closes or when a non-child closes.

Agree?

Is there some way these other event can determine why they are closing?

I especially need a non-child to know.

"Academia" <ac************ @a-znet.comwrote in message
news:OM******** ******@TK2MSFTN GP05.phx.gbl...
Sorry, I think I got it figured.

This is a Mdi app but some forms are not children.

I close these from the Mdi FormClosing event so I guess they see that
reason instead of the fact that the app is exiting.
"Academia" <ac************ @a-znet.comwrote in message
news:Oi******** ******@TK2MSFTN GP06.phx.gbl...
>Protected Overrides Sub OnFormClosing(B yVal e As
System.Windows .Forms.FormClos ingEventArgs)

MyBase.OnFormC losing(e)

Console.WriteL ine(e.CloseReas on.ToString )

always writes

UserClosing

No matter if I'm closing the form, exiting the app, shutting down windows
or using the Task Manager to shut down the app.

Does e.CloseReason work for you?

Thanks





Dec 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4870
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As InternetExplorer But then I cant see when a user exit my objIExplorer and than an error will show up when I try to open a link in the IE window that does not exist... What can I do about this and way does it not work in win 98?
5
3646
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug puposes only and is not normally visable to the user.) The Thread function is actually in the Form class. Now.. What I am seeing is that when I create an instance of this Class Library's Form, which starts the worker thread, it seems to hose up...
22
2632
by: Robert Bralic | last post by:
CAN anybody tell me any address where I can download some small(1000-2000) lines C++ proghram source. Or send me ,a small(1000-2000) lines C++ program source that I can compille with gpp under Linux Suse 7.1. I can't belive that C++ exists. Thanks in advance ! robert.bralic@si.htnet.hr
12
2957
by: Frank Hauptlorenz | last post by:
Hello Out there! I have a DB2 V7.2 Database (Fix11) on Win 2000 Professional. It was before a NT 4 based Domain - now it is a Win 2000 Domain. The database server is a domain member. Now sometimes Win 2000 Clients can't connect to the database. They connect over TCP/IP. The db2log says that the function getHostByName failed. It seems to be only on new installed win 2000 Workstations. Already installed WS have NOT this problem.
0
2374
by: Jarod_24 | last post by:
How does tabindex work in ASP .net pages I dosen't seem to work quite like in regular forms. and there isn't any TabStop property either. 1 .How do you prevent a control form beign "tabbed". (hidden textboxes ect.) 2. How do get a control to get focus when the page is loaded (think username textfield on a loginpage) 3. Does the tab-order work just like in regular forms (1 ->2 -> 3 and so on?) 4. How does tabindex work with datagrid...
14
4872
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it can be done using the designer but I intentionally don't want to use that. The one reason is that you cannot change the code generated by the designer. The other could be that you have more free hand and control to design your GUI. 2....
89
6103
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be used." Could anybody tell me why gets() function is dangerous?? Thank you very much. Cuthbert
14
3509
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src="" id="eventImage0" class="eventImage"><img src="" id="eventImage1" class="eventImage"></div>
4
5506
by: Andy | last post by:
Hi, I'm trying to begin a new application in Wpf, and I'm trying to do some similar things to what I have been in Wpf. For example, in WinForms I have a base BusinessEditForm class. This overrides OnClosing, which checks the CloseReason. If the reason is anything other than ApplicationExit, I prompt the user if they would like to save their changes if the business object being edited is dirty.
0
9953
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10422
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7980
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7137
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3242
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.