1
Answer

Displaying msgbox to close the opened child form.

Yogendra Sharma

Yogendra Sharma

12y
1.5k
1
Hi,

I m having 12 forms in my application. I want to display a message box asking the user to close the existing opened child form before opening other.

I had tried the following the code:

<pre lang="cs">
Form curfrm;
String a = " Please Close the other open windows";

private void admissionForm1ToolStripMenuItem_Click(object sender, EventArgs e)
       {
           adfrm1 af1 = new adfrm1(null);
           if (curfrm != null)
           {
               MessageBox.Show(a);
               return;
           }
           else
           {
               curfrm = af1;
               af1.MdiParent = this;
               af1.Show();
           }</pre>

This doesn't allow me to open the other forms after closing the child form.

Thanks.
Answers (1)