Access to the elements of parent form from child in MDI
<p>The problem is that i need to access different forms elements from other forms, or for example access MdiContainer form menu from some child windows and do some operations with it. How to correctly implement such feature? I'm using Windows Forms now.</p>

<p>Some sample code below to demonstrate how I tried to do it.</p>

<p><strong>Form1 (is an Mdi container)</strong></p>

<pre><code>public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void menu2ToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Form2 chWin = new Form2(this);
        chWin.Show();
    }

    public void disableMenu()
    {
        menuStrip1.Enabled = false;
    }
}
</code></pre>

<p><strong>Form2 (is a child of Form1)</strong></p>

<pre><code>public partial class Form2 : Form
{
    private Form1 parent;

    public Form2(Form1 parent)
    {
        InitializeComponent();
        MdiParent = parent;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        parent.disableMenu();
    }
}
</code></pre>

<p>And the exception:
Object reference not set to an instance of an object</p>

<p>Tried to google on it, but actually nothing helpful for my occasion.</p>

<p>Thanks in advance!</p>
