Problem with Abstract class for User Control

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

I have created an abstract class called BaseListUC which inherits from
UserControl. The BaseListUC has 4 abstract methods,
Add(), Edit(), Delete(), View(). I have then created a UserControl which
inherits from BaseListUC called MemberListUC. In MemberListUC, , I have
overriden the Add(), Edit(), View() and Delete() methods. Everything
compiles fine and it runs exactly the way that I want it to run. The
problem that I have though is that I can't view the MemberListUC in design
mode because it says

The designer must create an instance of type 'BaseListUC' but it cannot
because the type is declared as abstract.

How do I resolve this?


Bill
 
Don't make the base class abstract?

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 
I have created an abstract class called BaseListUC which inherits from
UserControl. The BaseListUC has 4 abstract methods,
Add(), Edit(), Delete(), View(). I have then created a UserControl which
inherits from BaseListUC called MemberListUC. In MemberListUC, , I have
overriden the Add(), Edit(), View() and Delete() methods. Everything
compiles fine and it runs exactly the way that I want it to run. The
problem that I have though is that I can't view the MemberListUC in design
mode because it says

The designer must create an instance of type 'BaseListUC' but it cannot
because the type is declared as abstract.

How do I resolve this?

The designer needs to instantiate the parent of the class being
designed, which means that the parent can not be abstract. This is a
limitation of the way the designer works.
 
Except it works under Visual Studio 2008, but I really don't want to use
that tool yet for this production app.
 
Back
Top