VB .NET: TopMost MDI Child?

The topMost property of MDI children doesn't seem to do anything. How can I make a particular mdi child always float over its siblings?

Thank you!
majnunAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iboutchkineCommented:
try to activate it

me.mdichildren(index).activate
0
Éric MoreauSenior .Net ConsultantCommented:
A children cannot be set TopMost. This is by design.
0
majnunAuthor Commented:
Ok, that's what I figured...

Is it possible then, to "confine" a form to be within the limits of another form? As it to mimic the parent-child relationship?

Thanks!
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

wguerramCommented:
Try this API

Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SetParent(frmChildForm.Handle, Me.Handle)
    End Sub
0
iboutchkineCommented:
You can try 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.

Here is an example

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ParentFrm As New Form1
        Dim ChildFrm As New Form2

        ChildFrm.TopMost = True

        ChildFrm.Owner = ParentFrm
        ChildFrm.Show()
    End Sub
0
iboutchkineCommented:
Here is anothe rexample for you when form2 will be within form1

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim f As New Form2
        f.TopLevel = False
        Me.Controls.Add(f)
        f.Left = 0
        f.Top = 0
        f.Show()
        f.BringToFront()

    End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
majnunAuthor Commented:
Cool.

Iboutchkine:

What are the practical differences between the owner form method, and adding a form as a control to another form? Are there benefits or draw backs to either of them?

Thanks!
0
majnunAuthor Commented:
I tried adding the form to the main forms controls collection... it seems so far exactly the behavior that I want.

It appears to be "inside" the main for like a child, and I can set its topmost property to be true and it floats over all the actual children of the main form.

You rock!

Thanks!
0
iboutchkineCommented:
The owner form can be outside the parent. Form as a control will be always inside the parent form container
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.