Working with owned forms

If a form owns another form, the owned form will be always displayed in front of its owner form, no matter which is the active form. This makes owned forms ideal for implementing tool and palette windows. Another feature of owned forms: when the user closes or minimizes the owner form, all the owned forms are also closed or minimized. When minimized, the owner forms and all its owned forms count as one icon in the Windows taskbar.

In Visual Basic 6, you can display a form as an owned form by passing Me as the second argument of the Show method, as in:

' The Visual Basic 6 way for creating an owned formDim frm As New CalleeFormfrm.Show , Me

You can’t pass any argument to the Show method under Visual Basic .NET, but you declare that the callee form is owned by the caller form by invoking the AddOwnedForm method:

' The Visual Basic .NET way for creating an owned formDim frm As New CalleeForm()' Add this form to the list of owned form.Me.AddOwnedForm(frm)frm.Show()

A form can detect whether it is being owned by another form using the Owner property; a form can enumerate its owned forms by iterating over the collection returned by the OwnedForms property.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS