nemaroller Posted November 7, 2003 Posted November 7, 2003 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? Quote
Leaders dynamic_sysop Posted November 7, 2003 Leaders Posted November 7, 2003 you need to use MyBase.Controls to look through the stuff on a form , rather than container. Quote
Administrators PlausiblyDamp Posted November 7, 2003 Administrators Posted November 7, 2003 Me.controls Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
nemaroller Posted November 7, 2003 Author Posted November 7, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.