Hi, I have just get an strange issue and maybe is correct … or not.
I have:
Dim mVal As Integer = -589
Hex(mval) --> FFFFFDB3
And
mVal.ToHex(8) --> 00000003
What is I missed here?
Thanks,
Best regards,
Kris
Hi, I have just get an strange issue and maybe is correct … or not.
I have:
Dim mVal As Integer = -589
Hex(mval) --> FFFFFDB3
And
mVal.ToHex(8) --> 00000003
What is I missed here?
Thanks,
Best regards,
Kris
Appears to be a bug in Integer.ToHex. It adds the negative value as a positive but starts back over at 0 instead of carrying.
Create a project with a listbox that has 2 columns.
Put the following code in a button action event and observe.
Dim a,b As Integer
for i as Integer = 0 DownTo -100
a = Integer.fromhex(Hex(i).totext)
b = Integer.FromHex(i.ToHex(8))
listbox1.AddRow(cstr(a),cstr(b))
next