A UInteger data type holds any value between 0 and 4,294,967,295 (ref. MSDN).
If I try this code in VB.NET, I get a compiler error:
Dim Test As UInteger = &HFFFFFFFF
Error: “Constant expression not representable in type ‘UInteger’.
Why I can’t set 0xFFFFFFFF (4,294,967,295) to a UInteger if this type can hold this value?
I believe it’s because the literal
&HFFFFFFFFis interpreted by the VB.NET compiler as anInteger, and that value for anIntegeris a negative number (-1), which obviously can’t be cast to aUInteger.This issue is easily fixed by writing
&HFFFFFFFFUI, appending theUIsuffix to treat the literal as aUInteger.