D
....DotNet4Ever....
I am trying to develop several windows forms user controls for my
application, therefore all of these inherit from
System.Windows.Forms.UserControl as I drop them from the toolbox into the
design surface. I created the user control on the design surface and added
the other winform controls that are grouped into that user control. At this
point it shows fine in the designer. At this point I have
// SomeCompositeControl.cs
public partial class SomeCompositeControl : System.Windows.Forms.UserControl
{
}
// SomeCompositeControl.Designer.cs
public partial class SomeCompositeControl
{
private System.ComponentMode.IContainer components = null;
:
}
Well, In all my winforms and user controls I follow the same pattern. For
that reason I wanted to create an abstract base class for my user control (I
named it MementoUserControlBase):
public abstract class MementoUserControlBase :
System.Windows.Forms.UserControl
{
:
}
and then my user control would be:
// SomeCompositeControl.cs
public partial class SomeCompositeControl : MementoUserControlBase
{
}
// SomeCompositeControl.Designer.cs
public partial class SomeCompositeControl
{
private System.ComponentMode.IContainer components = null;
:
}
The problem is the moment I use the custom base class approach then when I
open my control designer surface rather than being greeted by my carefully
arranged custom user control I get:
"The designer could not be shown for this file because none of the classes
within it can be designed. The
designer inpsected the following classes in the file:
SomeCompositeControl -- the base class 'MementoUserControlBase' could not
be loaded. Ensure the asembly has been referenced and that all projects have
been built"
Both the user control (SomeCompositeControl) and the base class
(MementoUserControlBase) build properly and are in the same project. The
entire project builds without errors.
So, what is wrong here? what sort of weird designer intricacy am I missing?
Emilio
application, therefore all of these inherit from
System.Windows.Forms.UserControl as I drop them from the toolbox into the
design surface. I created the user control on the design surface and added
the other winform controls that are grouped into that user control. At this
point it shows fine in the designer. At this point I have
// SomeCompositeControl.cs
public partial class SomeCompositeControl : System.Windows.Forms.UserControl
{
}
// SomeCompositeControl.Designer.cs
public partial class SomeCompositeControl
{
private System.ComponentMode.IContainer components = null;
:
}
Well, In all my winforms and user controls I follow the same pattern. For
that reason I wanted to create an abstract base class for my user control (I
named it MementoUserControlBase):
public abstract class MementoUserControlBase :
System.Windows.Forms.UserControl
{
:
}
and then my user control would be:
// SomeCompositeControl.cs
public partial class SomeCompositeControl : MementoUserControlBase
{
}
// SomeCompositeControl.Designer.cs
public partial class SomeCompositeControl
{
private System.ComponentMode.IContainer components = null;
:
}
The problem is the moment I use the custom base class approach then when I
open my control designer surface rather than being greeted by my carefully
arranged custom user control I get:
"The designer could not be shown for this file because none of the classes
within it can be designed. The
designer inpsected the following classes in the file:
SomeCompositeControl -- the base class 'MementoUserControlBase' could not
be loaded. Ensure the asembly has been referenced and that all projects have
been built"
Both the user control (SomeCompositeControl) and the base class
(MementoUserControlBase) build properly and are in the same project. The
entire project builds without errors.
So, what is wrong here? what sort of weird designer intricacy am I missing?
Emilio