Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Parent and Child Relationships
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Parent and Child Relationships
■ There are two types of possible parent/child relationships in Visual Basic
for MS-DOS:
┌┤■│ MDI Container ├┐
│ ┌───────┐ │ ◄──── In MDI applications, a container
│ │ Child │ │ form can have one or many child
│ │ Form │ │ forms. See: ◄MDI Applications►
│ └───────┘ │
└──────────────────────────┘
┌ Frame1 ────┐
A form, frame, or picture box can ──────► │(•) Option1 │
have one or many child controls. │( ) Option2 │
See: ◄Form► │( ) Option3 │
◄Frame Control► └────────────┘
◄Picture Box Control►
■ Placement of child objects in either case is always relative to the
container. This coordinate information is reflected in the Left, Top,
Height, and Width properties of the child form, or the Left and Top
properties of the child control.
■ Child forms and controls cannot be moved outside the boundaries of the
container. In addition, when a container form or control is moved, its
children move with it; their positions relative to the container's top
(upper-left) corner do not change.
■ A container form cannot receive the focus if any of its children are able
to receive the focus. In contrast, a picture box can receive the focus
even when it contains child controls. See: ◄Focus Definition►
■ When an MDI form is specified, all subsequently loaded forms become its
children. Loading a container form does not automatically load its
children; however, a reference to a child form automatically loads the
container form.
■ The container/child relationships for a form can be summarized as follows:
When an MDI form is: Its children are:
════════════════════ ════════════════════════════════════════════
Loaded Not automatically loaded
Unloaded Unloaded
Made invisible Made invisible
Made visible Previously visible children are made visible
Disabled Disabled
Enabled Previously enabled children are enabled
■ The Parent property for a child form or control refers to its container.
This allows you to access the container's properties, methods, or controls
at run time. For example, the following code fragment will print the
caption of the Command1 child control's container:
PRINT Command1.Parent.Caption
See: ◄Parent Property►