Export (0) Print
Expand All

Form.Owner Property

Gets or sets the form that owns this form.

[Visual Basic]
Public Property Owner As Form
[C#]
public Form Owner {get; set;}
[C++]
public: __property Form* get_Owner();
public: __property void set_Owner(Form*);
[JScript]
public function get Owner() : Form;
public function set Owner(Form);

Property Value

A Form that represents the form that is the owner of this form.

Exceptions

Exception Type Condition
Exception A window that is not a top-level window cannot have an owner.

Remarks

To make a form owned by another form, assign its Owner property a reference to the form that will be the owner.

When a form is owned by another form, it is minimized and closed with the owner form. For example, if Form2 is owned by form Form1, if Form1 is closed or minimized, Form2 is also closed or minimized. Owned forms are also never displayed behind their owner form. You can use owned forms for windows such as find and replace windows, which should not disappear when the owner form is selected. To determine the forms that are owned by a parent form, use the OwnedForms property.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Form Class | Form Members | System.Windows.Forms Namespace | AddOwnedForm | RemoveOwnedForm | OwnedForms

Show:
© 2014 Microsoft