Microsoft KB Archive/208613

From BetaArchive Wiki
Knowledge Base


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

  1. Start a new Windows CE HPC PRO Project in Visual Basic.
  2. Add two command buttons to Form1.
  3. 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
                        
  4. Run the project in emulation or in the remote device.
  5. Click on Command1 and the following message appears:

    Application Error:
    An error was encountered while running this program:
    Variable is undefined: 'BigError'
                        
  6. Click on Command2 and the following message = appears:

    500 Variable is undefined: 'BigError'
                        
  7. Stop the project from executing and uncomment the On Error Resume Next statement in the Command1_Click event.
  8. Run the project again.
  9. Click on Command1 and note that the application error does not occur anymore. This is expected.
  10. 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