Hi
Been trying with some converion of Hex numbers. One confusing thing for me is negative Hex values.
Let say:
But what I know should it be -92.
Or
But this returns the negative number:
Any other suggestions, or good explainations. I guess that there are better things but using the old IIF function...
Been trying with some converion of Hex numbers. One confusing thing for me is negative Hex values.
Let say:
Code:
Dim intResult As Integer
intResult = Int32.Parse("FFa4", Globalization.NumberStyles.HexNumber)
txtSum.Text = intResult 'Returns 65444
Or
Code:
txtSum.Text = "FFa4"
txtSum.Text = Convert.ToInt32(txtSum.Text, 16) 'returns 65444
Code:
Dim a As String = "&HFFa4"
Dim b As Integer
b = CInt(IIf(CInt("&H" & a.Substring(2, 1)) > 7 And a.Length = 6, "&HFFFFFFFFFFFF" & a.Substring(2), a))
txtSum.Text = b 'Returns -92