Search code examples
arraysvb.netintegeruint32

Value of type '1-dimensional array of Integer' cannot be converted to 'UInteger'. VB.NET


Pretty simple code no idea why it doesn't work obviously UInteger aka UInt32 can hold double of what Integer can hold so it doesn't make sense why it doesn't fit, it's not even negative it's just hexadecimals.

Dim xor_table As UInt32 = {&H40FC1578, &H113B6C1F, &H8389CA19, _
&HE2196CD8, &H74901489, &H4AAB1566, &H7B8C12A0, &H18FFCD, &HCCAB704B, _
&H7B5A8C0F, &HAA13B891, &HDE419807, &H12FFBCAE, &H5F5FBA34, &H10F5AC99, _
&HB1C1DD01}

Solution

  • Specify the constants with type characters.

        Dim xor_table() As UInt32 = {&H40FC1578, &H113B6C1F, &H8389CA19UI, &HE2196CD8UI, &H74901489, _
                                     &H4AAB1566, &H7B8C12A0, &H18FFCD, &HCCAB704BUI, &H7B5A8C0FUI, _
                                     &HAA13B891UI, &HDE419807UI, &H12FFBCAE, &H5F5FBA34, &H10F5AC99, _
                                     &HB1C1DD01UI}