Rediger

Del via


Conversion.Hex Method

Definition

Returns a string representing the hexadecimal value of a number.

Overloads

Hex(UInt32)

Returns a string representing the hexadecimal value of a number.

Hex(UInt16)

Returns a string representing the hexadecimal value of a number.

Hex(SByte)

Returns a string representing the hexadecimal value of a number.

Hex(Object)

Returns a string representing the hexadecimal value of a number.

Hex(UInt64)

Returns a string representing the hexadecimal value of a number.

Hex(Int32)

Returns a string representing the hexadecimal value of a number.

Hex(Int16)

Returns a string representing the hexadecimal value of a number.

Hex(Byte)

Returns a string representing the hexadecimal value of a number.

Hex(Int64)

Returns a string representing the hexadecimal value of a number.

Hex(UInt32)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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);
[<System.CLSCompliant(false)>]
static member Hex : uint32 -> string
Public Function Hex (Number As UInteger) As String

Parameters

Number
UInt32

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(UInt16)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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);
[<System.CLSCompliant(false)>]
static member Hex : uint16 -> string
Public Function Hex (Number As UShort) As String

Parameters

Number
UInt16

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(SByte)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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);
[<System.CLSCompliant(false)>]
static member Hex : sbyte -> string
Public Function Hex (Number As SByte) As String

Parameters

Number
SByte

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(Object)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(UInt64)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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);
[<System.CLSCompliant(false)>]
static member Hex : uint64 -> string
Public Function Hex (Number As ULong) As String

Parameters

Number
UInt64

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Attributes

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(Int32)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(Int16)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(Byte)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

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

Hex(Int64)

Source:
Conversion.vb
Source:
Conversion.vb
Source:
Conversion.vb

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

Required. Any valid numeric expression or String expression.

Returns

A string representing the hexadecimal value of a number.

Exceptions

Number is not specified.

Number is not a numeric type.

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