Visual inheritance problem...

D

Deena

Hi

I create a abstract base class("MyBaseForm") which extends
System.Windows.Forms.Form class. I add buttons,.... . I then extend another
class("MyDerivedForm") from "MyBaseForm". This compiles fine, runs fine but
as soon as I double click - MyDerivedForm - to view the form in the IDE
designer - the IDE designer gives me an error.

Is the a bug? I saw a similar post earlier with no suitable explanation.
This is basically what we are trying to do. Create a base class with
something like this:

namespace MyFormClassLibrary
{
public abstract class MyBaseForm : System.Windows.Forms.Form
{
public MyBaseForm ()
{
}

}
}

Then create another Form and change the superclass from
"System.Windows.Forms.Form " to the "MyPage" class created above:

namespace MyFormClassLibrary
{
public class MyDerivedForm : MyBaseForm
{
public MyDerivedForm()
{
}

}
}
 
N

Nicholas Paldino [.NET/C# MVP]

Deena,

The problem arises from the fact that the designer needs to be able to
instantiate the base class in order to expose a design surface. Because the
base class is declared as abstract, it can not do this. You will have to
remove the abstract modifier in order to get the designer to work on the
derived forms.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top