[AccessD] defining constants as hex numbers

Gustav Brock gustav at cactus.dk
Mon Nov 3 04:31:59 CST 2003


Hi John, Stuart

But be careful with values above the max. positive value of a signed
Integer

  &H7FFF

as these evaluates to negative values in VB.
Not even assigning such a value to a constant or a variable declared
as Long will help you.

If you expect, say, 65535 for &HFFFF, add the type declaration sign
for Long: 

  &HFFFF&

or make it initially a Long by adding and subtracting one

  &H10000 - 1

or wrap it, again forcing a Long and taking advantage of &HFFFF as a
fancy way of writing -1

  &H10000 + &HFFFF

The last one is a nice item to add in your box of tools for writing
unreadable code!

/gustav


>> how do you force VB to consider a number hex?  I thought there was something
>> like h0f but I can't get it to work and NOT help isn't.
>> 
> &H



More information about the AccessD mailing list