Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Here's the scenario folks:

 

I have 10-12 usercontrols that have a property called IsValid (and some others but irrelevant here).

 

I want to build a component that I can slap on any form, that will

 

Enumerate through the controls on the form, seeking out only my usercontrols, and check their IsValid properties.

 

Now, my only problem so far is, I cannot seem to figure a way to grab the controls on the form from the component. The Me.container only holds the component itself.

 

How do I get to the parent form (class) that the component exists on to grab its collectino of controls?

Posted

Well, I wish it was that easy, because that would have been a wonderful property (Me.Controls) to have access to.

 

Unfortunately, components do not have a Controls, Owner.Controls, or Parent.Controls property to derive that.

 

I guess a component does not become 'part' of a Form or similiar container in a manner similiar to adding say a textbox.

 

It appears I will have to manually set a reference to a Form or other container, and enumerate its controls via the reference. I was hoping to be able to slap a component (service) such as you do a tooltip component, and it 'knows' what controls are available to it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...