Converting Decimal Number to Hexadecimal Number

In VB6, we can convert a decimal number to a hexadecimal number and vice versa easily:

Here is the code for converting decimal number to hexadecimal number and vice versa:

1. To convert decimal to hexadecimal, use the following syntax:

Dim hex_val As String, myValue as Double

hex_val=Hex(myValue)

2. To convert hexadecimal to decimal, use the following syntax:

Dim hex_val As String, myValue as Double

myValue=CInt(“&H” & hex_val)

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone