Trying to use a reference to my mainform
<p>Yesterday I asked a question how it is possible to access my mainform from another form to give it the focus.</p>

<p><a href="http://stackoverflow.com/questions/7207165/giving-focus-back-to-main-form">Giving focus back to main form</a></p>

<p>The solution was to add a reference to the mainform when the new form is called.</p>

<p>This works great for <code>.focus()</code> by doing:</p>

<pre><code>Form mainform_instance;

public NewForm(Form mainform)
{
    this.mainform_instance = mainform;
    InitializeComponent();
}
</code></pre>

<p>However now I need to access a 'custom function' on the main form from my new form.</p>

<p>But I cannot access it since it is declared as <code>Form mainform_instance</code> and the <code>Form</code> type doesn't have my custom function. (at least that's what I think what goes wrong.)</p>

<p>So I thought I try:</p>

<pre><code>MainForm mainform_instance;
</code></pre>

<p>and</p>

<pre><code>Namespace.MainForm mainform_instance;
</code></pre>

<p>But both don't work.</p>

<p>How can I access my function (<code>foo()</code>) on the mainform from the new form?</p>

<p><strong>EDIT</strong></p>

<p>As requested by Adam Maras in comment:</p>

<pre><code>namespace Namespace
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }
</code></pre>

<p><strong>EDIT2</strong></p>

<p>MainForm code which calls the NewForm:</p>

<pre><code>newForm = new Namespace.NewForm(this);
newForm.Show();
</code></pre>

<p>NewForm construct:</p>

<pre><code>namespace Namespace
{
    public partial class NewForm : Form
    {
        // here I tried to do MainForm mainform_instance as well as in the construct param
        Form mainform_instance;

        public NewForm(Form mainform)
        {
            this.mainform_instance = mainform;
            InitializeComponent();
        }
</code></pre>
