The Owned property determines that a form is to be owned and is only available in the Form Editor.
Owner returns the Form object for the owner of a form.
Set f = Form.Owner
The Owned property can only be set in Form Editor. At design time you can set the Owned property determining that the form is to be loaded as an owned window. When set and when executing LoadForm, the form will be owned by the current active window (Me). When Me = Nothing at the time of execution of LoadForm the Owned property is ignored.
When you use this option, you achieve two interesting effects: the owned form is always shown in front of its owner (parent), even if the parent has the focus, and when the parent form is closed or minimized, all forms it owns are also automatically closed or minimized. You can take advantage of this feature to create floating forms that host a toolbar, a palette of tools, a group of icons, and so on. This technique is most effective if it is combined with the window state options Fixed and/or Tool/Palette. These option are specified with the LoadForm statement.
When a form is created with an owner, the owner object can be obtained with the Owner method.
OpenW 1
OpenW Owner Me, 2
AutoRedraw = 1
Dim f As Form
Set f = Win_2.Owner
Trace f ' Form(Win_1)
Do
Sleep
Until Win_1 Is Nothing Or Win_2 Is Nothing
CloseW 1 : CloseW 2
Debug.Show
Owned is a hidden property and not available in code.
A form can be created as being owned in code, when the Owner frm clause is used.
Form Object, Form, LoadForm, OpenW
{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}