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

Ok, next...
what is the code i need to use ? :S

in the FormWindow.Minimized condition
-Form1.panel1.visible=true

check if the Form2 is minimized
-if yes, Form1.panel1.visible=true;

It is not working :S
plizz help :)

did you set the "modifiers" property of panel1 to "protected internal" in the property box???

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 :)

Try this:

dlg.panel7.Visible = true;
dlg.panel7.BringToFront();

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();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.