Hi Herfried,
Thanks for you speedy reply. I can't say I have been successful with your
suggestion. Once the project has recognized that the base is abstract (you
can do quite a bit of work before it decides it doesn't want you to use the
designer on the abstract class anymore) it won't let go of the fact that the
base is abstract. I find, even if I remove the 'mustinherit' and any
'mustoverrides' from the base class the same error message appears on trying
to use the designer to open any derived classes - ie, that the class is
abstract. Thanks anyway,
[quoted text, click to view] "Herfried K. Wagner [MVP]" wrote:
> Nigel,
>
> "Nigel B" <NigelB@discussions.microsoft.com> schrieb:
> >I am trying to build (in the .NET IDE and using VB) an app that uses forms
> >I
> > am deriving from a base class which contains some functions declared as
> > 'mustoverride' and the base class declared 'mustinherit'. The base class
> > inherits windows.forms. I get an error message telling me that the
> > designer
> > cannot open the derived classes because the base is abstract. It seems
> > such a
> > basic requirement of mine that I can hardly believe this is true. It means
> > that I can't do any visual design on the derived forms. Does anyone know
> > a
> > way around this or am I missing something?
>
> That's a known limitation of the designer. You can partially work around it
> by using this code:
>
> \\\
>
> ' In the project properties the checkbox that defines the
> ' 'DEBUG' constant must be checked.
> #If DEBUG Then
> Public Class Foo
> #Else
> Public MustInherit Class Foo
> #End If
> ...
> End Class
> ///
>
> In release mode the class will be 'MustInherit'.
>
> --
> M S Herfried K. Wagner
> M V P <URL:
http://dotnet.mvps.org/> > V B <URL:
http://dotnet.mvps.org/dotnet/faqs/> >
Nigel,
"Nigel B" <NigelB@discussions.microsoft.com> schrieb:
[quoted text, click to view] >I am trying to build (in the .NET IDE and using VB) an app that uses forms
>I
> am deriving from a base class which contains some functions declared as
> 'mustoverride' and the base class declared 'mustinherit'. The base class
> inherits windows.forms. I get an error message telling me that the
> designer
> cannot open the derived classes because the base is abstract. It seems
> such a
> basic requirement of mine that I can hardly believe this is true. It means
> that I can't do any visual design on the derived forms. Does anyone know
> a
> way around this or am I missing something?
That's a known limitation of the designer. You can partially work around it
by using this code:
\\\
' In the project properties the checkbox that defines the
' 'DEBUG' constant must be checked.
#If DEBUG Then
Public Class Foo
#Else
Public MustInherit Class Foo
#End If
...
End Class
///
In release mode the class will be 'MustInherit'.
--
M S Herfried K. Wagner
M V P <URL:
http://dotnet.mvps.org/> V B <URL:
http://dotnet.mvps.org/dotnet/faqs/>
Hi Nigel,
The way the designer works is by instantiating your base class and hosting
that in the designer. You can see this at work if you debug visual studio and
put a breakpoint in the constructor of your base class - it will be hit when
you bring up the subclass in the designer, however the constructor of that
subclass doesn't get called. That's why you can design abstract forms, but
can't design forms where the direct superclass is abstract.
Hope that helps.
Regards,
Matt Garven
[quoted text, click to view] "Herfried K. Wagner [MVP]" wrote:
> Nigel,
>
> "Nigel B" <NigelB@discussions.microsoft.com> schrieb:
> >I am trying to build (in the .NET IDE and using VB) an app that uses forms
> >I
> > am deriving from a base class which contains some functions declared as
> > 'mustoverride' and the base class declared 'mustinherit'. The base class
> > inherits windows.forms. I get an error message telling me that the
> > designer
> > cannot open the derived classes because the base is abstract. It seems
> > such a
> > basic requirement of mine that I can hardly believe this is true. It means
> > that I can't do any visual design on the derived forms. Does anyone know
> > a
> > way around this or am I missing something?
>
> That's a known limitation of the designer. You can partially work around it
> by using this code:
>
> \\\
>
> ' In the project properties the checkbox that defines the
> ' 'DEBUG' constant must be checked.
> #If DEBUG Then
> Public Class Foo
> #Else
> Public MustInherit Class Foo
> #End If
> ...
> End Class
> ///
>
> In release mode the class will be 'MustInherit'.
>
> --
> M S Herfried K. Wagner
> M V P <URL:
http://dotnet.mvps.org/> > V B <URL:
http://dotnet.mvps.org/dotnet/faqs/> >
Are you sure that you rebuilt the project? Closed the open form's
designer window and reopened it?
Yes, VS cannot design a form derived from an abstract base class. No,
it doesn't get "stuck," as such: you have to close the design view
(window), rebuild the project, and reopen it again.
Don't see what you're looking for? Try a search.