Does e.CloseReason work for you?

  • Thread starter Thread starter Academia
  • Start date Start date
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
 
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.
 
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.
 
Back
Top