Inherits class in webpage

M

Marc Robitaille

Hello,

I created a VB class that inhertis from System.Web.UI.Page. I set the class
to be MustInherit because I set some subs and functions to be MustOverride.
I created a webform call frmClient. By default, the page inherits from
frmClient class. In the frmClient class, by default, it inherits from
System.Web.UI.Page. So, I changed this to my MustInherit class. I
implemented the subs and functions that my MustInherit class needs to be
implement. I saved every things and run my web application and it works.
This is where the problem started. I closed my webform to work in an other
file. After that. I tried to open again my webform. My IDE threw me an
exception that tell that there are some errors in my file probably due to
the CodeBehind or Inherits attributs of the @Page directive. What I did to
solve my problem is that I removed the MustInherit attribut of my class and
replace MustOverride by Overridable to my subs and functions of that class.
It is only after that, that I have been able to open my frmClient web page.

My question is:

Why I can't implement a MustInherit class in my frmClient Class? I need this
functionality because I want to be sure that certain methods are implemented
through all my webpages that inherit from my MustInherit class.

I must missing something
Marc R.
Thank you
 
K

Karl Seguin

VS.Net tries to create an instance of the class, which it obviously can't
because it's abstract. It does to to provide design-time support.

There's no workaround, and yes it is annoying...one solution might be to use
an interface rather than an abstract class though...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
M

Marc Robitaille

Thank you

Karl Seguin said:
VS.Net tries to create an instance of the class, which it obviously can't
because it's abstract. It does to to provide design-time support.

There's no workaround, and yes it is annoying...one solution might be to
use an interface rather than an abstract class though...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top