Previous | Index | Next 

[PRB] A form loaded with Load method might cause errors in its Unload event handler

A common VB6 technique consists of loading a form by means of the Load method, but keep it hidden and use it only as a container for hidden controls (for example, an MSComm control used to use the serial port).

This scenario is supported by VB Migration Partner, with one minor issue: when the form is later unloaded, the matching QueryUnload and Unload events fire after the form has been already disposed of. For this reason, the code in the these handler should never reference a control on the form, else a runtime error would occur.

 

Previous | Index | Next