UAE Exiting Windows when VB Form1 Unload Event Unloads Form2

ID Number: Q73656

1.00

WINDOWS

buglist1.00

Summary:

A Windows "Unrecoverable Application Error" (UAE) message will occur

if you terminate Microsoft Windows 3.0 under the following conditions:

1. A Visual Basic version 1.0 application is resident (running in the

background or foreground).

2. The Visual Basic application contains multiple forms.

3. The Unload event procedure of one form unloads another form.

4. The Visual Basic application is compiled and run as an .EXE program.

This problem does not occur when you run the program from the Visual

Basic development environment.

Microsoft has confirmed this problem in Microsoft Visual Basic

programming system version 1.0 for Windows. We are researching this

problem and will post new information here as it becomes available.

More Information:

Steps to Reproduce Problem

--------------------------

1. Start Visual Basic, and Form1 will automatically be created by

default. (If you already have a project loaded in the Visual Basic

environment, you can select New Project from the File menu

[ALT+F, N].)

2. From the File menu, choose New Form. This will create Form2.

3. Add the following code to Form1's Load event procedure:

Sub Form_Load ()

Form2.Show

End Sub

4. Add the following code to Form1's Unload event procedure:

Sub Form_Unload (Cancel As Integer)

Unload Form2

End Sub

5. From the File menu, choose Make EXE File (ALT+F, K) to create an

.EXE file.

6. From the Windows Program Manager's File menu, choose the Run

option, and run the Visual Basic .EXE program that you just

created.

7. Terminate Windows (ALT+F, X from the Windows Program Manager). The

Windows UAE message occurs. The computer may hang after you click on

the OK button of the UAE dialog box.

The UAE message incorrectly occurs because of the attempt to unload

Form2 from Form1's Unload event procedure. This is a known problem

when attempting to use the Unload method for one form from within the

Unload event procedure of another form.

To work around this problem, remove the Unload method from the Unload

event procedure or use the End statement in the Unload event procedure

instead.

Additional reference words: 1.00