Microsoft KB Archive/183420

{|
 * width="100%"|

FIX: App.End in Unload Event Causes Error

 * }

Q183420

-

The information in this article applies to:


 * Microsoft Windows CE Toolkit for Visual Basic 5.0, version 1.0

-

SYMPTOMS
An application error occurs in module Pvb.exe when running a VBCE application:

pvb.exe - Application Error

The exception Breakpoint

A breakpoint has been reached.

(0x80000003) occurred in the application at location 0x0135e2ab.

CAUSE
The error occurs when a form unload event procedure includes the App.End statement, and that form is closed using the Close button in the upper- right corner of the display.

RESOLUTION
The following are two workarounds for this problem:


 * Do not use the App.End statement in the form unload event procedure.
 * Set the ControlBox property of the form to False, thereby preventing the Close button from displaying. Provide a specific CommandButton (or other control) for the user to close the application.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Windows CE Toolkit for Visual Basic 6.0.

Steps to Reproduce Behavior
 Create a new Windows CE Project in Visual Basic 5.0. Form1 is created by default. Add a CommandButton to Form1.  Add the following code to the the code module of Form1:

  Private Sub Command1_Click App.End End Sub

Private Sub Form_Unload(Cancel As Integer) App.End End Sub  Save the project. Run the project. Use the CommandButton to close the form; the error should not occur. Re-run the project. Use the Close button in the upper-right corner of the display. The error described at the beginning of this article will occur.