PRB: Setting Form to Nothing Does Not Unload Form (129903)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q129903 SYMPTOMS
If you use the following code to set a Form variable to nothing, the form
does not unload:
Set Form1 = Nothing
CAUSE
Setting a form to nothing releases the handle or reference that Visual
Basic has to the form, but it does not cause the underlying form to be
unloaded. In fact, if you set a form to nothing, this invalidates the form
variable as a reference to the form so that later calls such as this fail:
Unload Form1
Then you have to reference the form via the Forms collection.
RESOLUTION
Use the Unload statement to explicitly unload your forms.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbprb KB129903 |
---|
|