Problem with Abstract class for User Control

  • Thread starter news.microsoft.com
  • 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
 
K

Kevin Spencer

Don't make the base class abstract?

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 
J

Jack Jackson

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.
 
B

BillG

Except it works under Visual Studio 2008, but I really don't want to use
that tool yet for this production app.
 

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