How to detect when owner form closes (from a control inside it)?
UPD I need the control to know that it's form is closing, not vice versa
Credits to Fredrik Mörk for this solution:
FindForm().FormClosing += parentForm_FormClosing;
You should intercept FormClosing event. In FormClosingEventArgs the variable CloseReason will show you why is the form closing. Your best bet is intercepting when this variable equals UserClosing enumerated value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With