Home >>VB.Net Built-in Functions >VB.Net program to demonstrate the Hex() function
The Hex() function is used to get the corresponding specified number for the Hex value.
Syntax :
Hex(num)
Parameters :
Return Value :
The Hex() function returns the Hex value corresponding to the integer number specified.
Program :
Below is the source code to demonstrate the Hex() function. The program given is compiled and successfully executed.
Module Module1
Sub Main()
Dim val As Integer = 13
Dim hexVal As String = ""
hexVal = Hex(val)
Console.WriteLine("Hex value: {0}", hexVal)
End Sub
End Module
Explanation:
We created a Module1 module in the program above that contains the Main() method. We created two variables, val and hexval, in the Main() method. The variable val is initialized with 13 here, and the variable hexVal with a blank string is initialized.
hexVal = Hex(val)
We used the Hex() function in the above code, which returns the Hex value corresponding to the integer number specified. Then, on the console screen, we printed a character.