Help with Hex 
Author Message
 Help with Hex

This is a multi-part message in MIME format.

------=_NextPart_000_01BCB3E5.C681A880
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Why does this statement return a negative number?

MsgBox CInt(&H97DD)

When I test in the windows calculator it returns  38877.
Any help would be greatly appreciated.

Tony
------=_NextPart_000_01BCB3E5.C681A880
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 =
color=3D"#000000" face=3D"Arial">Why does this statement return a =
negative number?<br><br>MsgBox CInt(&amp;H97DD)<br><br>When I test in =
the windows calculator it returns &nbsp;38877.<br>Any help would be =
greatly appreciated.<br><br>Tony</p>
</font></body></html>
------=_NextPart_000_01BCB3E5.C681A880--



Mon, 14 Feb 2000 03:00:00 GMT  
 Help with Hex

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>&nbsp;</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>&nbsp;</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 &quot;&amp;&quot; and use CLng, i.e.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>MsgBox CLng(&amp;H97DD&amp;)</DIV>
<DIV>&nbsp;</DIV>
<DIV>Hope this helps,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Doug.<BR>&nbsp;</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(&amp;H97DD)<BR><BR>When I test =
in the=20
    windows calculator it returns&nbsp; 38877.<BR>Any help would be =
greatly=20
    appreciated.<BR><BR>Tony</P></FONT></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_00D4_01BCB44B.4C91C620--



Tue, 15 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help: Converting Hex Colors to RGB

2. Help assigning HEX value to 1 byte field in VB3.0

3. hex string -> hex number

4. HEX HEX Thanks guys

5. Converting HEX without parity to HEX with even parity

6. Diff between Hex() and Hex$

7. VB Hex colours vs Netscape Hex colours

8. Converting hex value in str format to hex

9. Hex String to Hex Number

10. Hex number is negative, help?

11. Help me convert system color NAMES to hex or RGB VALUES

12. Hex conversions - HELP

 

 
Powered by phpBB® Forum Software