I'm getting a warning message in Visual Studio 2010 (the one in the title)
Basically I've made a generic form which has a bunch of variables, virtual functions.
It takes a class I made as a parameter and assigns it to a local variable (which is then put as a propety using getters and setters)
I then made another form which inherits from this form. All is well, it runs, but when I attempt to look at the designer of it, I get that error message.
public TAGeneric(TAManager iManager)
{
ControlHelper.SuspendDrawing(this);
mManager = iManager;
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint, true);
InitializeComponent();
SetupCommandBar();
ControlHelper.ResumeDrawing(this);
}
Thats the parent.
public TAAddInterval(TAManager iManager) : base(iManager)
{
InitializeComponent();
}
This is a child. Forget the fact I'm using a "manager" when it is frowned upon. Anyone shed some light on the problem? Literally works fine to run, but when it comes to trying to edit the graphical side in designer, It won't load it.
Thanks for the help.
I suspect you need to provide a parameterless constructor for the designer to use:
public TAAddInterval(TAManager iManager) : base(iManager)
{
InitializeComponent();
}
[Obsolete("This constructor only exists for the benefit of the designer...")]
public TAAddInterval() : this(null)
{
}
If you have some sort of fake TAManager
you could provide instead, that might avoid NullReferenceException
being thrown if the designer happens to hit some code which uses the manager.
You likely just need a parameterless constructor and the designer will work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With