VB Migration Partner

KNOWLEDGE BASE - Forms and controls


Previous | Index | Next 

[INFO] GotFocus and LostFocus events in UserControls

UserControl classes converted by VB Migration Partner correctly receive and fire the GotFocus and LostFocus events, with the following minor differences:

  1. The VB6 UserControl class receives a GotFocus or LostFocus event only if the user control contains no child controls that can take the input focus. For example, if a VB6 user control contains a textbox, the UserControl class never receives this event: if the class contains a UserControl_GotFocus method, this method is never invoked. When the program is converted to VB.NET, the UserControl_GotFocus and UserControl_LostFocus methods inside the class are always invoked. 
  2. If a VB6 UserControl doesn’t contain any child control that can take the input focus but it has its CanGetFocus property set to True, then the user control can take the input focus and correctly fires GotFocus and LostFocus events inside the parent form. A converted user control, however, fires these two events only if it receives the focus only by means of the Tab key or a mouse click directly on the user control’s surface. In other words, if the end user clicks on a child control (that can’t take the focus), then no event is fired in the parent form.
Previous | Index | Next 




Follow Francesco Balena on VB6 migration’s group on

LinkedIn





Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.




Code Architects and its partners offers remote and onsite migration services.

More details




Subscribe to our free newsletter for useful VB6 migration tips and techniques.

newsletter



To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice



A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial




The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote




Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers