Form - TopMost-VBForums
Results 1 to 3 of 3

Thread: Form - TopMost

  1. #1

    Thread Starter
    Addicted Member sinner0636's Avatar
    Join Date
    Sep 2009
    Posts
    233

    Form - TopMost

    hello

    i have a question about a forms topmost for say if i have a settings window or a about window and i want it to be topmost over the main forms window
    but i would like it to only top most within the application itself so its not showing over top of other programs on my pc any ideas how i can do this?

    see like in this pic here my settings will stay on top of my main form but will stay on top of other pc programs like the web browser i don't want that is there a workaround for this i have my settings window in the pic set to show in taskbar false does that have to do with it or is it the forms border style?

    Name:  topmost.jpg
Views: 108
Size:  25.7 KB
    Last edited by sinner0636; Jan 14th, 2018 at 02:16 PM.

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,498

    Re: Form - TopMost

    Just specify the owner form in show method
    Code:
    Form2.Show(Me)' Me refers to Form1
    BTW: usually forms like About & Settings are shown modal, so they will be app's top most.
    Last edited by 4x2y; Jan 14th, 2018 at 08:28 PM.



  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,723

    Re: Form - TopMost

    What you're talking about is a modeless dialogue or, in .NET parlance, an owned form. As 4x2y has demonstrated, you can create an owned form by passing the owner as an argument when calling Show or ShowDialogue (although it's generally pointless when calling ShowDialogue). You can also simply assign the owner to the dialogue's Owner property, or you can call AddOwnedForm on the owner. That will cause the owned form to remain above it's owner at all times. The owned form will also minimise, restore and close when it's owner does. It is a relationship between two forms only, not a form to every other form in the application. There's no easy way to keep a form that isn't a modal dialogue in front of all other forms in the application, but you'd rarely, if ever, want to.
    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
  •  



Featured


Click Here to Expand Forum to Full Width