Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Finding a Component's (ComponentModel.Component) Parent Form

Reply
Thread Tools

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

 
 
JackRazz
Guest
Posts: n/a
 
      03-04-2004
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
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      03-04-2004
"JackRazz" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
Refresh "parent" form after filling out child popUp form? Bob ASP .Net 1 08-31-2007 09:39 AM
accessing parent form from a child form.how? nass C++ 1 09-21-2006 10:38 AM
vs2005 - Open a child form based on selected record parent form's dgv - how? dbuchanan ASP .Net 2 12-19-2005 10:52 PM
close child form when parent form is closed. =?Utf-8?B?UGF1bA==?= ASP .Net 2 11-24-2004 10:31 AM



Advertisments