Yogendra Sharma

Yogendra Sharma

  • NA
  • 1
  • 1.5k

Displaying msgbox to close the opened child form.

Mar 1 2012 10:13 PM
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)