Myworld
Myworld

Reputation: 1899

error when display panel in windows form

I had windows form I did my code to display panel where condition but this error apeared (object refrencer.....) on panel1.Show();

public partial class Checker : Form
{
    public Checker()
    {
        RegistryKey adobe = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Adobe");
        if (adobe == null)
        {
            panel1.Show(); 
        }
    }

    private void OK_Click(object sender, EventArgs e)
    {

    }
}

Upvotes: 0

Views: 305

Answers (1)

Jens
Jens

Reputation: 3299

Seems like you don't have an instance of your panel1. Where is it declared? Is it a panel on a form somewhere? If so, where is your form declared?

If the code above is your form, you might want to call

InitializeComponent();

before you continue your constructor.

Upvotes: 3

Related Questions