Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Windows Forms
 How to: Keep a Windows Form on Top
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Windows Forms Programming
How to: Keep a Windows Form on Top

Updated: November 2007

Starting with the Microsoft Windows 2000 operating system, a top-most form always stays in front of all windows in a given application. In Microsoft Windows 98, a top-most form stays in front of all windows in all applications. For example, you may want to keep a floating tool window in front of your application's main window. The TopMost property controls whether a form is a top-most form. A top-most form will always float above other, non–top-most forms even when it is not active.

Note:

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To make a form the top-most form in a Windows Forms application at design time

  • In the Properties window, set the TopMost property to true.

To make a form the top-most form in a Windows Forms application programmatically

  • In a procedure, set the TopMost property to true.

    Visual Basic
    Public sub MakeOnTop()
       myTopForm.TopMost = True
    End Sub
    
    

    C#
    public void MakeOnTop()
    {
       myTopForm.TopMost = true;
    }
    
    

    J#
    public void MakeOnTop()
    {
       myTopForm.set_TopMost(true);
    }
    
    

    Visual C++
    public:
       void MakeOnTop()
       {
          myTopForm->TopMost = true;
       }
    
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker