Parent Assembly from Component

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've created a class library of controls/components. For the component i
implemented a custom designer that tracks the custom controls added to a
form. If i wanted to serialize the component out to a resource in the forms
assy, how do I get the reference to the Forms assy? Since it's a component
there is no FindForm method.... GetCallingAssy doesn't seem to work either...
I have to do it from the component so that on instantiation I can reload it
with all the useful data....
 
If i wanted to serialize the component out to a resource in the forms
assy, how do I get the reference to the Forms assy? Since it's a component
there is no FindForm method.... GetCallingAssy doesn't seem to work either...

Are you looking for IComponent.Site?


Mattias
 
Mattias,
IComponent.Site just returns the designerhost not the parent form or assy.
But i did figure out how to get there from the designerhost.... it's a bit
convoluted. Anyone know an easier way?

ISite s = component.Site;
IDesignerHost DH = (IDesignerHost) s.Container;
Assembly a =
System.Reflection.Assembly.GetAssembly(DH.RootComponent.GetType());
 

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

Back
Top