morbak morbak - 3 months ago 22
Vb.net Question

Convert a hex string into an unsigned decimal value

I want to convert an hex string into an unsigned value? How can I to do that?

Here's my code (not working):

address_2_WR_data1="0000F000"
az = ((Val("&H" & address_2_WR_data1)))


but the result is that: az=FFFFF000

Answer

You can use Convert.ToUInt32 to convert a hex string to an unsigned integer.

Dim address_2_WR_data1 As String = "F000F000"
Dim az As UInt32 = Convert.ToUInt32(address_2_WR_data1, 16)