c# Change control properties of another file

Asked

Viewed 44 times

0

i have 2 Forms(the login and the program) by the login of the person i qro that one of the 2 panels (within the program has 2 panels for each type of login: the Adm and work) go ahead but Login.CS I’m not able to pull the panels in the condigo to do 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
                }

1 answer

0


In order to have access to an object of another class this object cannot be private

Put a getter to access this object.

in Login.Cs

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

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

Bringtofront is a method, needs parentheses at the end.

frmLogin.Panel1.BringToFront();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.