Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleKeep a form on top of others
Keywordsform, top, on top, topmost, ontop
CategoriesAPI, Tips and Tricks
 
Use the API SetWindowPos to keep the form on top or not.
 
' Make the form topmost or not.
Private Sub SetOnTop(Optional ByVal on_top As Boolean = _
    True)
    If on_top Then
        SetWindowPos hwnd, _
            HWND_TOPMOST, 0, 0, 0, 0, _
            SWP_NOMOVE + SWP_NOSIZE
    Else
        SetWindowPos hwnd, _
            HWND_NOTOPMOST, 0, 0, 0, 0, _
            SWP_NOMOVE + SWP_NOSIZE
    End If
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated