Results 1 to 3 of 3

Thread: Bringing All Forms Back To Front

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    5

    Bringing All Forms Back To Front

    In VB6, if you have multiple windows forms open as part of one project, if you click one form, it brings all of them back into focus.

    However in .NET it seems to only bring back the one form you click on.

    Is there any way to replicate this behaviour in .NET so that it brings all of them back?

  2. #2
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: Bringing All Forms Back To Front

    Probably this post doesn't belong in the Architecture forum, but it's easy to answer. Make the main form the Owner of all the other forms. For example, set their Owner property (in code) to the main form. There are other ways such as the Form.AddOwnedForm method and Form.Show(owner). The result is that the Owned forms always stay in front of their Owner. BB

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Bringing All Forms Back To Front

    Quote Originally Posted by boops boops View Post
    Probably this post doesn't belong in the Architecture forum, but it's easy to answer. Make the main form the Owner of all the other forms. For example, set their Owner property (in code) to the main form. There are other ways such as the Form.AddOwnedForm method and Form.Show(owner). The result is that the Owned forms always stay in front of their Owner. BB
    That's not the same behaviour as VB6.

    I was thinking that you might be able to hack something by setting the TopMost property of each form and then resetting it. You'd have to know the z-order then though, which would probably require API calls.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width