You close the dialog in an unusual way, in the usual way this is done by setting the DialogResult form property. Winforms still synthesizes the FormClosed event in this case, but does it at the βwrongβ time, the window is still visible. He will immediately become invisible.
If you need a workaround for this, then this is possible, the trick is to defer everything you want to do in the FormClosed event handler. This is elegantly done using the Control.BeginInvoke () method, for example:
_form2.FormClosed += (s, a) => { this.BeginInvoke(new Action(() => MessageBox.Show("TEXT"))); };
And now you will see MessageBox after the window disappears.
Beware of errors in the code, you sign the FormClosed event more than once.
source share