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.
MORE INFORMATION
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:
500 Variable is undefined: 'BigError'
- Stop the project from executing and uncomment the On Error Resume Next statement in the Command1_Click event.
- Run the project again.
- Click on Command1 and note that the application error does not occur anymore. This is expected.
Click on Command2 and the following error message appears:
"500 Variable is undefined".
Note that the error description information has been lost.
Additional query words: wce evb
Keywords: kbtoolkit kbprb KB208613