By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,320 Members | 2,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,320 IT Pros & Developers. It's quick & easy.

Inheritance problems

P: n/a
What's up with inheritance in code behind? Is it reliable, or should I skip
it and forget about using inheritance in web forms until they get it right?

I'm using VB.NET 2005

I have a web form named wfBase.aspx.

In the code behind I have

Partial Public Class wfBase
Inherits System.Web.UI.Page

and I have some public methods and variables.

I have another form named wfForm.aspx. In this code behind I have

Imports wfBase 'is this necessary?
Partial Class wfForm
Inherits wfBase

Everything works great.
Suddenly it stops working, and there are errors that wfBase contains no
public members.
I have to close Visual Studio and open it again, and then it works fine for
awhile, and then it happens again. Sometimes I only have to close the
solution and open it again. This is very aggravating.

Is there something I could be doing wrong?

Thanks
Bill
Mar 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Don't inherit the other part of your partial classes. Partial classes are
classes which are defined in multiple source code documents, which are
merged at compile-time. In essence, you're defining your class as inheriting
itself, which is what is causing the problem.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

"bill" <be****@datamti.com> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl...
What's up with inheritance in code behind? Is it reliable, or should I
skip it and forget about using inheritance in web forms until they get it
right?

I'm using VB.NET 2005

I have a web form named wfBase.aspx.

In the code behind I have

Partial Public Class wfBase
Inherits System.Web.UI.Page

and I have some public methods and variables.

I have another form named wfForm.aspx. In this code behind I have

Imports wfBase 'is this necessary?
Partial Class wfForm
Inherits wfBase

Everything works great.
Suddenly it stops working, and there are errors that wfBase contains no
public members.
I have to close Visual Studio and open it again, and then it works fine
for awhile, and then it happens again. Sometimes I only have to close the
solution and open it again. This is very aggravating.

Is there something I could be doing wrong?

Thanks
Bill

Mar 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.