It's not necessary to convert the value to a decimal, cause the system interprets a variety of representation like a number.
Try this code to check:
Dim nValor As Long
'To take hex representation in VB, follow number by an &H sign
nValor = &HFF
nValor = nValor - 1
I've tried and it works perfectly.
If you have to show in HEX format again, you'll need to convert the format you desire, but think the number is ALWAYS the same - only the representation of it is changing...
By the way, you can represent it in many other forms, such as integer, floating point, hexadecimals, binaries, but in VB the variable is always the same thing: a number. You may take care only with precisions for a variable - certain types are more accurately, certain types are less - it means if you put a really greater value like 80000 in an integer type variable, you may get overflow error...
Hope this helps.
In VB6, how would I subtract 1 from a Hex?
Do I need to convert to Integer first?
(have tried HextoDec function, but not having success)
I think you can use this to solve your problem by following the instructions you can convert the hex to decimal then subtract one then reverse the process to display the new hex. Yes the hex value would be FF FE
If you scroll down the page you will find
Converting a Hex or Octal Number to Decimal
To convert a hexadecimal or octal number to a decimal value, you must treat the hex or octal value as a string, append "&H" or "&O" in front of the value, and use a conversion function such as Val or CLng to convert the string to a numeric value.
Dim strMyHexNum As String
Dim lngDecimalValue As Long
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...