Object Reference > True DBGrid Properties > Parent Property |
This property sets or returns the parent style of a named style object.
style.Parent= variant
Read/Write at run time and design time (with restrictions).
If a style has no parent, then this property returns a null variant.
The Parent property is used at run time to change the parent style from which the style in question inherits. Typically, this is done when creating a new style in code, as in the following example:
Dim BoldHeading As TrueDBGrid60.Style
Set BoldHeading = TDBGrid1.Styles.Add("BoldHeading")
BoldHeading.Parent = "Heading"
BoldHeading.Font.Bold = True
This code first creates a new style, BoldHeading, then sets its parent to the built-in Heading style. This causes the new style to inherit all attributes from the built-in style. The bold attribute of the new style's font is then overridden.
Note
For an independent style object, a trappable error will occur if you attempt to set the Parent property. An independent style object is not a member of the Styles collection, but is a standalone object created in code with a Dim or Set statement using the New keyword.