How To Use an Ampersand (&) to Suppress Sign Extension
Article ID: 138520
Article Last Modified on 7/13/2004
APPLIES TO
- Microsoft Visual Basic 5.0 Control Creation Edition
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
- 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
This article was previously published under Q138520
SUMMARY
Adding an ampersand (&) character to the end of a Hexadecimal number will
ensure that it is not sign extended. This can be useful when an unsigned
constant must be passed to a routine and the magnitude of the constant is
greater than or equal to 32,768 (&H8000 in Hexadecimal). If the ampersand
is not placed on the end of the constants, Visual Basic assumes that the
numbers are sign extended.
Keywords: kbhowto kbprogramming KB138520