devxlogo

The behavior of the LostFocus event depends on VB version

The behavior of the LostFocus event depends on VB version

The behavior of the LostFocus event has changed in the transition from VB4 to VB5. Under VB4, if a control on a form has the input focus and the user clicks on a toolbar button, the control fires a LostFocus event. Under VB5 and VB6, the same action doesn’t fire any LostFocus event, so you must aware of this detail if you’re porting an application from VB4 to a later version.

The behavior under VB5 and later versions is more consistent, because the toolbar should be considered as a sort of menu, and clicking on a menu doesn’t raise any LostFocus event, under any version of VB.

Under VB6, however, this action raises a Validate event, so you have the opportunity to execute a piece of code when the focus leaves the control.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
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