page inheritance bug fixed

J

JR

I'm developing in VS.NET 2002 and I'm having trouble working around the
issue with page inheritance and the VS.NET Form Designer.

When I create a base class for my form, and inherit from it, I can no longer
bring up the inherited form in the designer. I get the error "The file
failed to load in the Web form designer. please correct the following error,
then load it again : Type Abstract"

Apparently, others have experienced this problem and one workaround is not
declaring the base class as MustInherit.

However, I have a problem with that. My base class handles some processing
in Page_Load. In order to handle some instance-specific handling in the
derived class, I added an Initialize method in the base class and flagged it
as Overridable originally.

If I'm forced to remove the MustInherit and Overridable attributes in my
base class to work around the VS designer issue, then when my code executes,
the Initialize method executes IN THE BASE CLASS, as opposed to in the
derived class. That's not what I want (which is .

I can probably fix this by refactoring the way I'm handing the
initialization, but I'd still like to know if the VS.NET designer issue has
been corrected.
 
S

Steven Cheng[MSFT]

Hi JR,

The problem that we get error when open a form(no matter web form or
winform) in designer which is dervied from an abstract base class is a
known behavior. In fact, this is because when we open a form in the
VS.NET's design view, the IDE will try creating an instance of the Form's
base class( notice that it is the base class rather than the derived actual
class). The reason why the IDE not create the instance of the derived class
is that the Dervied class is the one under edit and its properties or
interfaces may haven't been completed so the IDE is only able to instantial
its base class and apply the derived class's properties and features onto
the base class instance. Here are some former threads in the group
discussing this problem:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=Z#7nTi9PEHA.308
%40cpmsftngxa10.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%2
6q%3D%2Babstract%2Bclass%2Bsteven%2Bcheng

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=15ad101c229b0$0
3216ba0%2436ef2ecf%40tkmsftngxa12&rnum=10&prev=/groups%3Fhl%3Den%26lr%3D%26i
e%3DUTF-8%26q%3Dform%2Bdesigner%2Babstract%2Bclass

Hope also helpful on understanding this. Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top