C # windows form, how to hide the panel and display after clicking the button?

advertisements

I have a panel that contains a lot of textboxes and labels. I want to hide it before i enter password, after button click, that panel need to be shown. So when I try to run the program, it has null reference exception. I'm new at windows form coding.

public form1() {

 panel.Visible=false;

}


Make sure you call this line after the InitializeComponent() method call in the constructor :-)

Eg:

public Form1()
{
    InitializeComponent();

    // Your code here
}