Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

  • *Experts*
Posted

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:

#if DEBUG
public class MyBaseForm : Form
#else
public abstract class MyBaseForm : Form
#endif

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
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.
  • *Gurus*
Posted

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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...