Search code examples
vb.netwinformsfocussetfocus

How to get my VB.net form to focus above existing users windows and applications?


I have a Visual Basic .Net form (launches after the splash screen tests database connectivity) and it is not focusing above other existing windows on launch.

How do I get it to focus above all existing windows and Windows Explorer windows?


Solution

  • Form.Topmost = true;
    

    See the corresponding MSDN.

    A topmost form is a form that overlaps all the other (non-topmost) forms even if it is not the active or foreground form. Topmost forms are always displayed at the highest point in the z-order of the windows on the desktop. You can use this property to create a form that is always displayed in your application, such as a Find and Replace tool window.