Does e.CloseReason work for you?

A

Academia

Protected Overrides Sub OnFormClosing(ByVal e As
System.Windows.Forms.FormClosingEventArgs)

MyBase.OnFormClosing(e)

Console.WriteLine(e.CloseReason.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
 
A

Academia

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.
 
A

Academia

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.
 

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