Groups | Blog | Home
all groups > dotnet compact framework > may 2004 >

dotnet compact framework : How to find a parent of the component


yevvi NO[at]SPAM yahoo.com
5/18/2004 8:19:46 PM
Hi,
I need to design a custom component (that is i want it to be on the
component tray, not on the form, in the designer), but I also need to
get the form object to which it belongs at runtime. Is it possible to
do it in compact framework?
For the control I could use the Parent property, but component doesn't
have it.
The IContainer and ISite properties of the component dont seem to be
supported for compact framework. Any ideas?

Thanks,
Zanna
5/20/2004 9:52:56 AM
Yev ha scritto:

[quoted text, click to view]

If it does not belong to the form (in the designer is not applied to the
form) why you should can get a parent form?

Maybe you want to apply a .Owner property to your component to old
information about the "linked parent".

Bye

--
Math Parser : http://www.neodatatype.net
yevvi NO[at]SPAM yahoo.com
5/20/2004 5:59:59 PM
[quoted text, click to view]

Actually it does belong to the form. When you drag components on the
component tray in the designer it will generate a code to add them as
instance members of the form which you are designing. But unlike
controls, components will not be added to the Controls collection of
the form.
If i add "Owner" property to my component, that will work, but the
user will have to set this property at run time and i would like to
avoid that.
(That is i want my component's code to find out which form it is on)

Is there a way to find at run time all the forms loaded into an
application?
Then i could use reflection api to find out the one which has my
component.

Thanks,
AddThis Social Bookmark Button