Form.Container property

  • Thread starter Thread starter jon morgan
  • Start date Start date
J

jon morgan

Hello,

When I put components on a form the designer appears to package them up
nicely in a container component.

Does the inherited System.Windows.Forms.Form read-only Container property
give access to these components?

If not, how can I access a form's component list given only a reference to
the form "As Form" ?

Thanks for any help

Jon
 
Hi Jon,

I'm not sure why you would want to do this. Accessing members (controls) in
this way sounds suspiciously like a design decision that you might regret
later on?

Can you shed some light?
 
Hello Matthew,

I am using a hook function on a subclassed common dialog to determine when
the caller has pressed the dialog's help button so that I can display my
help system.

The hook function provides me with a handle to the dialog and from there I
can the parent form's handle using the GetParent API function. Then I can
get a reference to that form : Dim f As Form = Control.FromHandle(hwnd). The
parent form has a Help Provider component which contains the helpfile's
path.

In my previous post I had thought the Container property of the parent form
would give access to its components, but of course it doesn't - it just
references that forms' parent etc.

I guess my underlying reason for trying to do it this way rather than simply
passing the help file's path to my common dialog dll is to try to cut down
on the number of help providers I have in my app. and to avoid multiple file
references.

Hope this is clear and by the way thanks for a great site at .Net 247 -
indispensable !!


Jon
 
Back
Top