Reference > Child Object > Child Object Properties > Parent Property (Child) |
Parent Property (Child)
This property sets or returns the parent of a named object.
object.Parent= Child
Read/Write at run time. Not available at design time.
When the object is first created, Nothing will be set by default.
The Parent property is used at run time to change the parent from which the child control settings inherits. This property makes it easier and faster for the user by creating a complete clone of the parent object. Typically, this is done when creating a new Child object in code, as in the following example:
Dim objChild As TDBContainer3D6Ctl.Child
Set objChild = TDBContainer3D1.Effects.Add(, "Text2")
objChild.Parent = "Text1"
objChild.Name = "Text2"
This code first creates a new Child object named "Text2", then sets its parent to an existing Child object named Text1. This causes the new child object to inherit all attributes from the existing object. The Name property of the new object is then overridden. Note that the Parent property should not be defined after setting the Child object properties. If you do, this will cause all property settings to be initialized to the parent settings again.
This property also allows you to pass in an object or an index number that points to an element within the Children collection.
' Set an object
objChild.Parent = TDBContainer3D1.Children("Text1")
' Set an index number
objChild.Parent = 1
See Also