5
Answers

Form1.Visible = false equivelent in C#.NET 2.0

Brad Finn

Brad Finn

15y
8k
1
I am fairly new to C#.NET, only been writing it for about 6 months.

Have writen VB for around 8 years.

I have a simple application I am making in C#.net and I have 2 forms.

I want to hide both form from Form2.

At the moment I have

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

Error    1    An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Control.Visible.get'

so this.Visible = false works but Form1.Visible = false doesn't.

Answers (5)