c # Change control properties of another file

0

I have 2 forms (the login and the program) by the login of the person I have that one of the 2 panels (inside the program has 2 panes for each type of login: adm and official) go ahead however Login.CS I'm not able to pull the panels in place to bring bring to front and both are in the same namespace

            if (Olho.HasRows)
            {
                Roteador Form1 = new Roteador();
                this.Hide();
                Form1.Show();
                Olho.Read();
                int Valor = Convert.ToInt32(Olho[1]);

                if(Valor == 1)
                {
                  *aqui eu colocaria o Panel.BringToFront
                }
                else
                {
                  *aqui eu colocaria o Panel.BringToFront
                }
    
asked by anonymous 07.06.2018 / 21:47

1 answer

0

To access an object of another class this object can not be private

Place a getter to access this object.

Login.cs

public Panel Panel1
{
    get { return this.panel1; }
}

public Panel Panel2
{
    get { return this.panel2; }
}

BringToFront is a method, needs parentheses in the end.

frmLogin.Panel1.BringToFront();
    
07.06.2018 / 22:41