Conversion.Hex Conversion.Hex Conversion.Hex Conversion.Hex Method

Definition

Returns a string representing the hexadecimal value of a number.

Overloads

Hex(UInt32) Hex(UInt32) Hex(UInt32) Hex(UInt32)

Returns a string representing the hexadecimal value of a number.

Hex(UInt16) Hex(UInt16) Hex(UInt16) Hex(UInt16)

Returns a string representing the hexadecimal value of a number.

Hex(SByte) Hex(SByte) Hex(SByte) Hex(SByte)

Returns a string representing the hexadecimal value of a number.

Hex(Object) Hex(Object) Hex(Object) Hex(Object)

Returns a string representing the hexadecimal value of a number.

Hex(UInt64) Hex(UInt64) Hex(UInt64) Hex(UInt64)

Returns a string representing the hexadecimal value of a number.

Hex(Int32) Hex(Int32) Hex(Int32) Hex(Int32)

Returns a string representing the hexadecimal value of a number.

Hex(Int16) Hex(Int16) Hex(Int16) Hex(Int16)

Returns a string representing the hexadecimal value of a number.

Hex(Byte) Hex(Byte) Hex(Byte) Hex(Byte)

Returns a string representing the hexadecimal value of a number.

Hex(Int64) Hex(Int64) Hex(Int64) Hex(Int64)

Returns a string representing the hexadecimal value of a number.

Hex(UInt32) Hex(UInt32) Hex(UInt32) Hex(UInt32)

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Hex(Int32)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(System::UInt32 Number);
[System.CLSCompliant(false)]
public static string Hex (uint Number);
static member Hex : uint32 -> string
Public Function Hex (Number As UInteger) As String

Parameters

Number
UInt32 UInt32 UInt32 UInt32

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(UInt16) Hex(UInt16) Hex(UInt16) Hex(UInt16)

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Hex(Int16)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(System::UInt16 Number);
[System.CLSCompliant(false)]
public static string Hex (ushort Number);
static member Hex : uint16 -> string
Public Function Hex (Number As UShort) As String

Parameters

Number
UInt16 UInt16 UInt16 UInt16

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(SByte) Hex(SByte) Hex(SByte) Hex(SByte)

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Hex(Byte)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(System::SByte Number);
[System.CLSCompliant(false)]
public static string Hex (sbyte Number);
static member Hex : sbyte -> string
Public Function Hex (Number As SByte) As String

Parameters

Number
SByte SByte SByte SByte

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(Object) Hex(Object) Hex(Object) Hex(Object)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(System::Object ^ Number);
public static string Hex (object Number);
static member Hex : obj -> string
Public Function Hex (Number As Object) As String

Parameters

Number
Object Object Object Object

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(UInt64) Hex(UInt64) Hex(UInt64) Hex(UInt64)

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.Conversion.Hex(Int64)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(System::UInt64 Number);
[System.CLSCompliant(false)]
public static string Hex (ulong Number);
static member Hex : uint64 -> string
Public Function Hex (Number As ULong) As String

Parameters

Number
UInt64 UInt64 UInt64 UInt64

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(Int32) Hex(Int32) Hex(Int32) Hex(Int32)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(int Number);
public static string Hex (int Number);
static member Hex : int -> string
Public Function Hex (Number As Integer) As String

Parameters

Number
Int32 Int32 Int32 Int32

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(Int16) Hex(Int16) Hex(Int16) Hex(Int16)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(short Number);
public static string Hex (short Number);
static member Hex : int16 -> string
Public Function Hex (Number As Short) As String

Parameters

Number
Int16 Int16 Int16 Int16

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(Byte) Hex(Byte) Hex(Byte) Hex(Byte)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(System::Byte Number);
public static string Hex (byte Number);
static member Hex : byte -> string
Public Function Hex (Number As Byte) As String

Parameters

Number
Byte Byte Byte Byte

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Hex(Int64) Hex(Int64) Hex(Int64) Hex(Int64)

Returns a string representing the hexadecimal value of a number.

public:
 static System::String ^ Hex(long Number);
public static string Hex (long Number);
static member Hex : int64 -> string
Public Function Hex (Number As Long) As String

Parameters

Number
Int64 Int64 Int64 Int64

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim testHex As String
' Returns 5.
testHex = Hex(5)
' Returns A.
testHex = Hex(10)
' Returns 1CB.
testHex = Hex(459)

Remarks

If Number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If Number is Hex returns
Empty Zero (0)
Any numeric value Up to sixteen hexadecimal characters

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

See also

Applies to