I'm writing a code where when the user clicks a button, a child form pops up and the user types in information. When the child form comes up, the parent is minimized. I want the parent form to come back up when the user clicks the x button. I'm trying to set the FormWindowState property back to normal in the childform_FormClosed event, but the child form closes while the parent continues to be minimized. I'm using VS community 2019; I saw someone that was able to access the form closing event property through the properties window in the design tab, but I can't find where that is in my version of VS, so I wrote this code in. I've tried the following:
In child form:
private void ChildForm_FormClosed(object sender, FormClosingEventArgs e)
{
ParentForm frm = (ParentForm)Application.OpenForms["ParentForm"];// find open form
frm.WindowState = FormWindowState.Normal;
}
You could register the Closed event within the parent. Those are also available 'outside' the form it self.
For example: (pseudo code)
This is what you asked,
This is what I advise, using the ShowModal, which blocks the current method execution. So after the method, you can continue doing what you want to do.