Abstract Base Class Conflicts with the Design View

  • Thread starter Thread starter Faisal Yaqoob
  • Start date Start date
F

Faisal Yaqoob

In my application, I have created a base form that contains the common
functions used across all the forms in my application. I want to make some
functions of this class abstract, which makes the whole class abstract. Now,
when other developers derive their classes from this class the .NET IDE
fails to open the form in design view and gives the error that "The designer
must create an instance of type 'frmBaseGraph' but it cannot because the
type is declared as abstract."

Is there a work around?

Currently, I have made the functions that were abstract as 'virtual' to keep
the things going, but I need a solution to this problem.

Thanks,

Project Leader,
YieldWerx Semiconductor
 
Hi Yield
The problem here is that you are building an abstract class that has a
visual element ( a form ) if you are to use that form class as base for
other forms ( sure an instance of it need to be created , which is not
possible).so what you can do is you either make your abstract class a
normal one with no UI element or remove that abstract keyword form your
function ( may be you still leave them with no implementation) . this is
not only with form but with all UI elements ( base in not abstract), check
this tread
http://www.dotnet247.com/247reference/msgs/55/277589.aspx

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
Back
Top