Microsoft KB Archive/208613

= PRB: "On Error Resume Next" Statement Causes Loss of Extra Error Information =

Article ID: 208613

Article Last Modified on 8/19/2005

-

APPLIES TO


 * Microsoft Windows CE Toolkit for Visual Basic 6.0
 * Microsoft eMbedded Visual Basic 3.0

-



This article was previously published under Q208613



SYMPTOMS
The On Error Resume Next statement causes loss of extra error message information such as err.description for undefined variables. This could be important because undefined variables are not caught at compile time when Option Explicit is enabled.



Steps to Reproduce Behavior
 Start a new Windows CE HPC PRO Project in Visual Basic. Add two command buttons to Form1.  Paste the following code into Form1: Option Explicit Private Sub Command1_Click 'On Error Resume Next BigError = "This is a big error!" End Sub

Private Sub Command2_Click MsgBox Err.Number & " " & Err.Description End Sub  Run the project in emulation or in the remote device.  Click on Command1 and the following message appears: Application Error: An error was encountered while running this program: Variable is undefined: 'BigError'   Click on Command2 and the following message = appears: <pre class="fixed_text">500 Variable is undefined: 'BigError' </li> Stop the project from executing and uncomment the On Error Resume Next statement in the Command1_Click event.</li> Run the project again.</li> Click on Command1 and note that the application error does not occur anymore. This is expected.</li>  Click on Command2 and the following error message appears: <pre class="fixed_text">"500 Variable is undefined". Note that the error description information has been lost. </li></ol>

Additional query words: wce evb

Keywords: kbtoolkit kbprb KB208613

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.