Home »
VB.Net »
VB.Net Programs
VB.Net program to demonstrate the Hex() function
By Nidhi Last Updated : November 11, 2024
Hex() function in VB.Net
The Hex() function is used to get the Hex value corresponding specified number.
Syntax
Hex(num)
Parameter(s)
- num: Specified integer number.
Return Value
The Hex() function will return the Hex value corresponding specified integer number.
VB.Net code to demonstrate the example of Hex() function
The source code to demonstrate the Hex() function is given below. The given program is compiled and executed successfully.
'VB.Net program to demonstrate the Hex() function.
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
Output:
Hex value: D
Press any key to continue . . .
Explanation:
In the above program, we created a module Module1 that contains a Main() method. In the Main() method, we created two variables val and hexval. Here, variable val is initialized with 13 and variable hexVal is initialized with a blank string.
hexVal = Hex(val)
In the above code, we used the Hex() function that will return the Hex value corresponding to the specified integer number. Then we printed the character on the console screen.
VB.Net Basic Programs »