MustInherit gives a problem

  • Thread starter Thread starter AAaron123
  • Start date Start date
A

AAaron123

I'm thinking of using Must so I've been reading about it. I found
something on the following site:

http://www.thescripts.com/forum/thread746452.html


The following is excerpted from it.
December 8th, 2007
05:25 PM
#4

///
Re: Must give a problem
--------------------------------------------------------------------------------

The designer creates an instance of the base class and then runs the
Initialize method from the current class.

I believe I read that this is fixed in VS2008.

I don't really understand the above.
\\\

1) Is it fixed in VS2008?

2) If not what is the work around

3)If there is no work around could you say a few more words about the
problem?


Thanks
 
I'm thinking of using Must so I've been reading about it. I found
something on the following site:

http://www.thescripts.com/forum/thread746452.html


The following is excerpted from it.
December 8th, 2007
05:25 PM
#4

///
Re: Must give a problem
--------------------------------------------------------------------------------

The designer creates an instance of the base class and then runs the
Initialize method from the current class.

I believe I read that this is fixed in VS2008.

I don't really understand the above.
\\\

1) Is it fixed in VS2008?

I don't think the behavior is any different in 2008.
2) If not what is the work around

Well, typically, I will add virtual methods/properties (Overridable) to
my base form, and then have them throw a System.NotImplemented exception
if they are called. It's about the best solution I've found.
3)If there is no work around could you say a few more words about the
problem?

It's not exactly a "problem" - the IDE has to create an instance of the
base form, and can't because it's abstract (MustInherit).
 
AAaron123 said:
I'm thinking of using Must so I've been reading about it. I
found something on the following site:

http://www.thescripts.com/forum/thread746452.html


The following is excerpted from it.
December 8th, 2007
05:25 PM
#4

///
Re: Must give a problem
--------------------------------------------------------------------------------

The designer creates an instance of the base class and then runs the
Initialize method from the current class.

I believe I read that this is fixed in VS2008.

I don't really understand the above.
\\\

1) Is it fixed in VS2008?

2) If not what is the work around

3)If there is no work around could you say a few more words about
the problem?


Do you have MustOverride declarations? What do you expect the Designer
to do in these MustOverride procedures? If there are no such procedures,
does the Form really have to be MustInherit-able? Sometimes, you won't
instanciate the Form itself and only an inherited one, but it wouldn't
do any harm (read: still creates a consistent object) if the base
class is instanciated. So, why is it declared MustInherit?


Armin
 
thanks

Patrice said:
3) The designer needs to create the class to brought up the visual
designer but as you mentioned that the class can't be created, it can't
and fails...

2) The message you mentioned list a possible workaround. You could perhaps
design a superclass and add the mustinherit in a lower class with this
additional member that is the one you'll expose and likely others I didn't
thought off.....

1) Don't know but you'll likely have something to do (perhaps adding an
attribute made for this purpose ?)
 
Thanks, I like your answer to 2

Tom Shelton said:
I don't think the behavior is any different in 2008.


Well, typically, I will add virtual methods/properties (Overridable) to
my base form, and then have them throw a System.NotImplemented exception
if they are called. It's about the best solution I've found.


It's not exactly a "problem" - the IDE has to create an instance of the
base form, and can't because it's abstract (MustInherit).
 
Armin Zingler said:
Do you have MustOverride declarations? yes

What do you expect the Designer
to do in these MustOverride procedures?
Nothing, they are subs that I wanted to be sure I implemanted on the derived
forms.
Actually I added the MustOverride and after I fixed the one form I forgot to
add the sub to I removed it.
I could have just checked the 30 forms but this ia less error prone.


Thanks



If there are no such procedures,
 
Back
Top