How to call a form and hide the previous one in C #?

0

I'm in the middle of college project and I'm having a hard time.

The system has a Form main and when I call the second Form the main is still visible. How do I hide the form master while the second is open?

The code to call the second form and this:

F_CalcSimples F_CalcSimples = new F_CalcSimples();

F_CalcSimples.ShowDialog();

If anyone can help, thank you very much!

    
asked by anonymous 27.12.2015 / 19:03

1 answer

3

Use the Visible property of your form principal to return or set if an object is visible, see example:

private void button1_Click(object sender, EventArgs e)
{
    this.Visible = false;

    Form2 meu_segundo_form = new Form2();
    meu_segundo_form.ShowDialog();

    this.Visible = true;
}

More information here .

More about the property Visible .

    
27.12.2015 / 19:26