Wordsmyth's Corner

How to Avoid Common Designer Problems

Common problems that cause the Visual Studio forms designer to go kerflooey. See also Debugging Designer Problems and Loader Exceptions.

Abstract Methods In Base Classes

Abstract methods in a base form/control class will cause the designer to crap out. This has to do with the fact that the designer tries to create the parent in addition to creating the child.
   // Kills the designer.

   public class BaseControl : UserControl
   { 
   protected abstract void HandleLanguageChanged();
   }

   // Try this instead.

   public class BaseControl : UserControl
   { 
   protected virtual void HandleLanguageChanged()
      {
      throw new NotImplementedException(this.ToString() + " missing handle language method.");
       }
   }

Parameters In Base Class CTORs

Again this has to do with the designer trying to construct the base class object.
   // Kills the designer.

   public class BaseForm : Form
   { 
      Remote m_remote;

      public BaseForm(Remote remoteDisplay)
      {
      }
   }

Other Classes In The Form Class File

The form class has to be the first class in the form class file.
   // Kills the designer

   public class TriangleButtonColors
   {
   }
   
   public class TriangleButton
   {
   }

   // Try this instead
   // (Or put them in separate files, which is generally better practice anyway.) 

   public class TriangleButton
   {
   }

   public class TriangleButtonColors
   {
   }