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

Inheritance

P: n/a
I have a solution with 3 projects - 1 exe and two dll's

In the exe I usually inherits forms from one of the dll's (main-classes etc). Now I want to add an inherited form from within the exe. But when I try I get the error "Ensure that the file is a valid .Net Framework Assembly" - and I cannot select a parent form from the forms in my exe

And I am quite sure that the exe is a "valid .Net Framework Assembly" - I really can't see what else it could be....and for that reason, how to "make sure"...

Regards benny
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ok dont kill me if I am wrong, but this is what I think.
Every form itself inherits from System.Windows.Forms.Form

Now if you want to create a form that inherits from another form in the same
assembly, fundamentally you wont be able to do it because the moment you add
a form to your Project that form is going to inherit from
System.Windows.Forms.Form (By default)

So the only way you can add inheritance to a form is via referencing to
external assembly
for e.g.

Public Class frmNewForm
Inherits MyformAssembly

Where MyFormAssembly is a form which is basically inherting from
System.Windows.Forms.Form

Abhi
"Benny" <an*******@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
I have a solution with 3 projects - 1 exe and two dll's.

In the exe I usually inherits forms from one of the dll's (main-classes etc). Now I want to add an inherited form from within the exe. But when I
try I get the error "Ensure that the file is a valid .Net Framework
Assembly" - and I cannot select a parent form from the forms in my exe.
And I am quite sure that the exe is a "valid .Net Framework Assembly" - I really can't see what else it could be....and for that reason, how to "make
sure"....
Regards benny

Nov 20 '05 #2

P: n/a
No - that is not the problem. If you were right inheritance would be disabled in one-project solution...and besides I have successfully inherited from within the same project previously

This problem was solved by removing the reference "WMPLib" in the project (some Window Media Player stuff...). So it seems that using Windows Media Player in a project invalidates inheritance in some way.

"Solved" this I managed to inherited a form from my within my exe. Next problem is that it the windows forms designer returns the error "The service System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType"....How to solve that???

Regards
benn

Nov 20 '05 #3

P: n/a
Yep my bad, you can actually inherit from a form within the same assembly. I
tried it today and it worked perfect for me.


"Benny" <an*******@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
No - that is not the problem. If you were right inheritance would be disabled in one-project solution...and besides I have successfully inherited
from within the same project previously.
This problem was solved by removing the reference "WMPLib" in the project (some Window Media Player stuff...). So it seems that using Windows Media
Player in a project invalidates inheritance in some way.
"Solved" this I managed to inherited a form from my within my exe. Next problem is that it the windows forms designer returns the error "The service
System.Windows.Forms.Design.IEventHandlerService already exists in the
service container. Parameter name: serviceType"....How to solve that????
Regards
benny

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.