HighTechTalks DotNet Forums  

Finding a Component's (ComponentModel.Component) Parent Form

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Finding a Component's (ComponentModel.Component) Parent Form in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
JackRazz
 
Posts: n/a

Default Finding a Component's (ComponentModel.Component) Parent Form - 03-04-2004 , 01:27 AM






I'm working on a .net component (not a control) and need to find out what form the
component is contained in during runtime (DesignMode=False). With a control, there
is a parent property (and FindForm) to do this with, but no such luck with a
component.

I was thinking that I might be able to iterate thru the Container.Components with
something like this with the Site.Name being the components name. This assumes that
a form is added to the container.components.

Dim c As IComponent
For Each c In Me.Container.Components
Console.WriteLine(c.Site.Name)
Next

But this doesn't seem to work. Does anyone have any idea as to how I can determine
what form a component is placed on??

Thanks - JackRazz







Reply With Quote
  #2  
Old   
John Saunders
 
Posts: n/a

Default Re: Finding a Component's (ComponentModel.Component) Parent Form - 03-04-2004 , 04:22 PM






"JackRazz" <JackRazz (AT) NotValid (DOT) com> wrote

Quote:
I'm working on a .net component (not a control) and need to find out what
form the
component is contained in during runtime (DesignMode=False). With a
control, there
is a parent property (and FindForm) to do this with, but no such luck with
a
component.

I was thinking that I might be able to iterate thru the
Container.Components with
something like this with the Site.Name being the components name. This
assumes that
a form is added to the container.components.

Dim c As IComponent
For Each c In Me.Container.Components
Console.WriteLine(c.Site.Name)
Next

But this doesn't seem to work. Does anyone have any idea as to how I can
determine
what form a component is placed on??
What about your components Site property? It has a Container property (as
well as a DesignMode property).
--
John Saunders
John.Saunders at SurfControl.com




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.