Get a reference to the Form from a IComponent on the ComponentTray
-
I have a IComponent (like DataSet) on the ComponentTray of a Form. Having only this IComponent , how can i get a reference to the Form? Thanks.
-
I have a IComponent (like DataSet) on the ComponentTray of a Form. Having only this IComponent , how can i get a reference to the Form? Thanks.
Get the
Site
property (returns anISite
). Then get theContainer
property. There's your container for the component.Microsoft MVP, Visual C# My Articles
-
Get the
Site
property (returns anISite
). Then get theContainer
property. There's your container for the component.Microsoft MVP, Visual C# My Articles
I have already tried that, and it returns an Microsoft.VisualStudio.Designer.Host. I think that probably i should use Site.GetService to get an appropriate service that have a reference to the form. But i don't know what service is that (or even if it exist..). Thanks
-
I have already tried that, and it returns an Microsoft.VisualStudio.Designer.Host. I think that probably i should use Site.GetService to get an appropriate service that have a reference to the form. But i don't know what service is that (or even if it exist..). Thanks
I guess it returns that because during design-time it's hosted in the component tray. The service that should help would be the
System.ComponentModel.Design.IReferenceService
.Microsoft MVP, Visual C# My Articles
-
I guess it returns that because during design-time it's hosted in the component tray. The service that should help would be the
System.ComponentModel.Design.IReferenceService
.Microsoft MVP, Visual C# My Articles
It is exactly whant i was lookinig for!! Tahnks!