VB Migration Partner

KNOWLEDGE BASE - Forms and controls


Previous | Index | Next 

[PRB] Invoking the Show method of MDI child forms containing one or more ActiveX controls might not fire the Load event

When an MDI child form hosts one or more ActiveX controls, in certain cases this control prevents the form’s Load event from firing when the form is displayed by means of the Show method. We are investigating this problem, but in the meantime here are a few workarounds.

The simplest solution is that you host the ActiveX control inside a container, such as a Frame or a PictureBox control. In such a case, the Load event fires correctly.

Another simple workaround: you explicitly load the form before showing it. You can do it via an InsertStatement pragma, so that the VB6 code isn’t affected;


         '## InsertStatement Load6(frmChildMDI)
         frmChildMDI.Show

A minor problem with this workaround is that the Load event fires after the form has already become visible. To avoid this side-effect you can proceed as follows: set the MdiChild property to False before invoking the Show method and assign the MdiParent property inside the Form_Load event hander:


         ' in the main application
         Private Sub cmdShowForm_Click()
  '## InsertStatement frmChild1.MdiChild = False
  frmChild1.Show()
  End Sub   ' inside the MDI child form   Private Sub Form_Load() Handles MyBase.Load
  '## InsertStatement Me.MdiParent = VB6MdiForm.Instance
  ...
  End Sub
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