hey, I have created two forms. in one form there is a panel, which is
Form1:

Panel1.visibel = false;

Form2: When the

WindowState == FormWindowState.Minimized

then the panel1 in form1 needs to be visible, but how to do that ? :S

Waleed Ahmed

change the "Modifiers" property of the panel of Form1 to "protectedinternal" so that it can be accessible from Form2

Yes i did, this is the code i inserted in the form2 :)

if (this.WindowState == FormWindowState.Minimized)
            {
                Form1 dlg = new Form1();
                dlg.panel7.Visible = true;
            }

this code is in form2_Load

first you have to show the form then only the panel will be visible i guess

Form1 dlg = new Form1();
dlg.Show();
dlg.panel7.Visible = true;

Nope, the both forms are running. i dont make any of the form visible = false :)
plizz help :)

Do i need to use an if statement ?
and if i need to how would it be like and where to put it. I dont think the code i am using is right in the form_load function

Without an IF statment:

WindowState == FormWindowState.Minimized
dlg.panel7.Visible = true;
dlg.panel7.BringToFront();

or with it:

IF (WindowState.IsMinimized)
{
   dlg.panel7.Visible = true;
   dlg.panel7.BringToFront();
}
This article has been dead for over six months. Start a new discussion instead.