I am trying to detect that form2 is closed in form1. I have this so far
private void AddStageBtn_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.ShowDialog();
if (form2.IsDisposed)
{
MessageBox.Show("it was closed!");
}
}
Any suggestions? Thanks again!
Adhere to the
FormClosedevent of form2.Wherever you create it do:
Then create the method:
You’ll also want to use
.Show()instead of.ShowDialog()if you want to be able to use either form, otherwiseform1will be unavailable untilform2is closed (which I am assuming is not the behavior you are looking for).