Form inherit error

vnarod

Well-known member
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 cant because the type was declared as abstract"

What does it mean and what should I do?
 
Theres a problem in .NET where the Form Designer wont show your inherited form if its 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 dont 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 theres no way around this well-known issue except the hack Nerseus suggested.
 
Back
Top