Created
February 27, 2017 21:20
-
-
Save WildGenie/49f6160dfd08d0a19adf0b06ff9cb90e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnParentChanged(EventArgs e) | |
{ | |
base.OnParentChanged(e); | |
if (parentForm != null) | |
{ | |
parentForm.Closing -= parentForm_Closing; | |
} | |
parentForm = FindForm(); | |
if (parentForm != null) | |
parentForm.Closing += parentForm_Closing; | |
} | |
void parentForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) | |
{ | |
parentForm.Closing -= parentForm_Closing; | |
parentForm = null; | |
//closing code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment