Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB .NET: TopMost MDI Child?

Posted on 2004-10-26
9
Medium Priority
?
1,841 Views
Last Modified: 2008-01-09
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!
0
Comment
Question by:majnun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12414231
try to activate it

me.mdichildren(index).activate
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12415208
A children cannot be set TopMost. This is by design.
0
 

Author Comment

by:majnun
ID: 12416348
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:wguerram
ID: 12416933
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
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12416966
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
 
LVL 28

Accepted Solution

by:
iboutchkine earned 2000 total points
ID: 12417027
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
 

Author Comment

by:majnun
ID: 12422145
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
 

Author Comment

by:majnun
ID: 12422287
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
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12422476
The owner form can be outside the parent. Form as a control will be always inside the parent form container
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question