devxlogo

Taking a Form in Front of Another Form

Taking a Form in Front of Another Form

When building a floating toolbar, you might need to keep it in front of the main form of your application. This took time to do in VB3 and VB4, because you had to resort to API functions. In VB5, you can take advantage of a new, optional argument of the Show method:

 ' within the main formfrmFloating.Show 0, Me

The second argument sets the owner form for the window being displayed. The “owned” form will always be in front of its owner, even when it doesn’t have the input focus. Moreover, when the owner form is closed, all its owned forms are automatically closed also.

See also  Does It Make Sense to Splurge on a Laptop?
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist