Form inherit error

vnarod

Regular
Joined
Mar 22, 2002
Messages
84
I have created a form that inherits from another form. When I try to open it in designer view I get the message:
"The designer must create an instance of type "DataEntry.frmMasterForm" but it can't because the type was declared as abstract"

What does it mean and what should I do?
 
There's a problem in .NET where the Form Designer won't show your inherited form if it's inheriting from an abstract class. For now, you can use "#if DEBUG" (in C#) to change the declaration of the class, as in:
C#:
#if DEBUG
public class MyBaseForm : Form
#else
public abstract class MyBaseForm : Form
#endif

-Nerseus
 
But my class is not declared as abstract (I don't even know what an abstract class is :-( ). It has only MUSTINHERIT option and I cannot turn it off because it has some MustOverride functions.
 
MustInherit in VB is the same as abstract in C#.

The designer has to create an instance of the base class in order to design it, so unfortunately there's no way around this well-known issue except the hack Nerseus suggested.
 
Back
Top