This is a multi-part message in MIME format.
------=_NextPart_000_00D4_01BCB44B.4C91C620
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Tony:
The reason you are getting a negative number is because an Integer
in VB is a *signed* integer ( 2 bytes -32,768 to 32,767)
If you want to get the *unsigned* value (or Long Integer in VB) then
type cast the value to a Long by appending a "&" and use CLng, i.e.
MsgBox CLng(&H97DD&)
Hope this helps,
Doug.
Why does this statement return a negative number?
=20
MsgBox CInt(&H97DD)
=20
When I test in the windows calculator it returns 38877.
Any help would be greatly appreciated.
=20
Tony
=20
------=_NextPart_000_00D4_01BCB44B.4C91C620
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1120.0"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>Hi Tony:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>The reason you are getting a negative number is =
because an=20
Integer</FONT></DIV>
<DIV><FONT size=3D2>in VB is a *signed* integer (</FONT><FONT =
color=3D#000000=20
size=3D2> 2 bytes -32,768 to 32,767)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>If you want to get the *unsigned* =
value (or Long=20
Integer in VB) then</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>type cast the =
value to a=20
Long by appending a "&" and use CLng, i.e.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV>MsgBox CLng(&H97DD&)</DIV>
<DIV> </DIV>
<DIV>Hope this helps,</DIV>
<DIV> </DIV>
<DIV>Doug.<BR> </DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
<P><FONT color=3D#000000 face=3DArial size=3D2>Why does this =
statement return a=20
negative number?<BR><BR>MsgBox CInt(&H97DD)<BR><BR>When I test =
in the=20
windows calculator it returns 38877.<BR>Any help would be =
greatly=20
appreciated.<BR><BR>Tony</P></FONT></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_00D4_01BCB44B.4C91C620--