Siebel VB Language Reference > VB Language Reference >

Hex Function


This standard VB function returns the hexadecimal representation of a number, as a string.

Syntax

Hex[$](number)

Argument
Description

number

Any numeric expression

Returns

The hexadecimal representation of number as a string.

Usage

If number is an integer, the return string contains up to four hexadecimal digits; otherwise, the value is converted to a long integer, and the string can contain up to 8 hexadecimal digits.

To represent a hexadecimal number directly, precede the hexadecimal value with &H. For example, &H10 equals decimal 16 in hexadecimal notation.

The dollar sign ($) in the function name is optional. If it is included, the return type is string. Otherwise the function returns a variant of vartype 8 (string).

Example

This example returns the hex value for a number entered by the user.

Sub Button_Click
   Dim usernum as Integer
   Dim hexvalue as String
   usernum = 23
   hexvalue = Hex(usernum)
End Sub

See Also

Format Function
Oct Function

Siebel VB Language Reference