title: Windows Forms, Designer, and Singleton
body: <p>I'm trying to work with Windows Forms and User Controls and thus far it's been nothing but a headache. I can't make the form or the controls static because the designer doesn't like that and when I use Singleton on my form and controls, the designer still throws errors at me. </p>
  
  <p>My FormMain:</p>
  
  <pre><code>public partial class FormMain : Form
  {
      private static FormMain inst;
  
      public static FormMain Instance
      {
          get
          {
              if (inst == null || inst.IsDisposed)
                  inst = new FormMain();
              return inst;
          }
      }
  
      private FormMain()
      {
          inst = this;
          InitializeComponent();
      }
  </code></pre>
  
  <p>MainScreen.cs:</p>
  
  <pre><code>public partial class MainScreen : UserControl
  {
      private static MainScreen inst;
  
      public static MainScreen Instance
      {
          get
          {
              if (inst == null || inst.IsDisposed)
                  inst = new MainScreen();
              return inst;
          }
      }
  
      private MainScreen()
      {
          inst = this;
          InitializeComponent();
      }
  </code></pre>
  
  <p>If the constructor of MainScreen is public the program runs, but when I change it to private I now get an error in FormMain.Designer.cs saying "'Adventurers_of_Wintercrest.UserControls.MainScreen.MainScreen()' is inaccessible due to its protection level". It points to this line:</p>
  
  <pre><code>        this.controlMainScreen = new Adventurers_of_Wintercrest.UserControls.MainScreen();
  </code></pre>
  
  <p>I think this is the instance of the class that the designer makes by default. Should I ditch the designer? Or is there a way around this? Or is there another way to make class properties accessible without using Singleton (since I can't seem to make the form or controls static)? Any help would be greatly appreciated.</p>