What is the ParentContainer property?


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
What is this property and why is it set to the form?

This is used as a synchronization object within the controls.  Since the container and the form will be operating on the same thread this is never going to be an issue.  To get the direct parent of any object you only need to reference the control like this:

MyControl.Parent

The ParentContainer property ties in with the ISynchronizeInvoke interface and properly working with delegates and threads.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm attempting to write some code that will add controls to a form dynamically at runtime and when I look at the Designer file to see what is generated by the designer, for the SF controls, the ParentContainer property is set. E.g.





' This code is in the designer.

myTextBox.ParentContainer = Me.





Now, what has me confused is that this is set even when the control is added to a container, like a flowlayoutcontainer or tablelayoutcontainer or panel, etc. What is this property and why is it set to the form?



(So I don't break anything tooo badly:blinkSmile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search