Microsoft KB Archive/143422

= PRB: Can't Set Certain DataTypes to Minimum Documented Value =

Article ID: 143422

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition

-



This article was previously published under Q143422



SYMPTOMS
Setting a currency, long, integer, or double to its minimum documented value is not valid. If you hard code the value, then the error message: "INVALID Number" from Visual Basic 3, and "Expected: expression" from Visual Basic 4 displays. However, if you try set a variable of any of these types at run-time, an Overflow Error displays.



CAUSE
The reason for this behavior is that Microsoft Visual Basic reads all negative numbers first as their absolute value, and then applies a unary negative. Because Microsoft Visual Basic puts the absolute value into a placeholder of the type identified by the type suffix, it reports the error when the positive limit is exceeded.



RESOLUTION
Negative values that are greater in absolute value than the maximum positive value are invalid.



STATUS
This behavior is by design.



MORE INFORMATION
INTEGER: -32768%

LONG: -2,147,483,648&

CURRENCY: -922337203685477.5808@

DOUBLE: -1.79769313486232E308#

Additional query words: kbDSupport kbdss kbVBp400 kbVBp300 kbNoKeyword

Keywords: kbprb KB143422

-

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

© Microsoft Corporation. All rights reserved.