title: An unhandled exception of type 'System.StackOverflowException' occured in WTApp
body: <p>I am converting an App from VB.NET to C# in WinForms apps.</p>
  
  <p>The problem arose when I realised that you can't access other forms directly like you can in VB.NET e.g :</p>
  
  <pre><code>Public Class frmMain
       Private Sub Preferences_Click(sender...
             frmPreferences.Show()                                           
       End Sub
  End Class
  </code></pre>
  
  <p>So I had a look online and It seemed like I had to declare a reference to the form before I could change its controls' values. So:</p>
  
  <p><br>I now have two separate forms. One named <code>frmPreferences</code> which looks like this without the extra bits of code:</p>
  
  <pre><code>public partial class frmPreferences : Form
      {
          frmMain frmMain = new frmMain();
      }
  </code></pre>
  
  <p><br>And the other, <code>frmMain</code>, just declaring the other form:</p>
  
  <pre><code>public partial class frmMain : Form
      {
          frmPreferences frmPreferences = new frmPreferences();
      }
  </code></pre>
  
  <p>The Call stack shows:</p>
  
  <blockquote>
    <p>WTAppCSharp.exe!WTAppCSharp.frmMain.frmMain() Line 17   C#<br>
        WTAppCSharp.exe!WTAppCSharp.frmPreferences.frmPreferences() Line 38 C#<br>
    WTAppCSharp.exe!WTAppCSharp.frmMain.frmMain() Line 17   C#<br>
        WTAppCSharp.exe!WTAppCSharp.frmPreferences.frmPreferences() Line 38 C#<br>....</p>
  </blockquote>
  
  <p>I'm just not sure how to reference the forms correctly, or, what I'm doing wrong :( </p>
  
  <p>Hope someone can help :)</p>