Search code examples
c#winformsuser-controlsdesigner

Control are not loaded in designer in C#


A very simple example. I have two classes:

public class BaseControl : UserControl  {  }

public partial class MyControl : BaseControl 
{
    public MyControl()
    {
        InitializeComponent();
    } 
}

I can open BaseControl in designer mode, but MyControl can not (VS 2008). I CAN NOT just inherit class MyControl from class UserControl. Is there any way to solve this problem?


Solution

  • Make sure you have classes defined this way:

    public class BaseControl : UserControl  
    {  
        public BaseControl()
        {
            InitializeComponent();
        } 
    }
    
    public partial class MyControl : BaseControl 
    {
        public MyControl()
        {
            InitializeComponent();
        } 
    }