Designer cannot load abstract-derived controls

G

Guest

Hi,

Check the following code:

public class Foo : TestControl
{
}

public abstract class TestControl : System.Windows.Forms.Control
{
}

The Visual Studio designer cannot load Foo because it will try to create the
abstract class TestControl while it should only be dealing with Foo. Why is
that? Can I fix this?
 
G

Guest

It is becoming a habit to answer my own posts :). Anyway, it is indeed
reported as a bug:

"Unfortunately the Windows Forms designer will not be able to design classes
that directly inherit from abstract types. When designing a Form or
UserControl, the designer instances the base type and then makes
modifications to that instance and serializes the differences to code as a
new type. Since we cannot instance the base abstract type, we cannot design
this type. "
 

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