Microsoft KB Archive/216547

= BUG: Err.Raise 40040 Stores the Err.Number as 440 =

Article ID: 216547

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q216547



SYMPTOMS
When the statement Err.Raise 40040 is executed, the value of Err.Number is set to 440.



RESOLUTION
Do not use the user defined error 40040.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
If you raise the error code 40040 (=&H9C68) using the Err.Raise method, Visual Basic sets the value of Err.Number to 440. The Err.Description and other properties of the Err object are set correctly.

Steps to Reproduce Behavior
 Create a Visual Basic Standard EXE project. Form1 is created by default.  Paste the following code in the General Declarations section of Form1:

Private Sub Form_Load On Error Resume Next Err.Raise 40040 MsgBox Err.Number & ": " & Err.Description ' will display 440 Err.Clear ' Clear the error for the next Raise method Err.Raise 440 MsgBox Err.Number & ": " & Err.Description End Sub  Run the program. A message box with the error number and description raised for 40040 will be displayed. Click OK and a message box with the error number and description raised for 440 will be displayed.

Keywords: kbbug KB216547

-

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

© Microsoft Corporation. All rights reserved.