Hex Function


Hex Function

Class

Microsoft.VisualBasic.Conversion

Syntax

     Dim result As String = Hex(number) 


number (required; numeric or string value)

A number, or a string that can be interpreted as a number. Nonintegral numbers are rounded before conversion.

Description

The Hex function returns a string that represents the hexadecimal value of a numeric expression.

Usage at a Glance

  • Nonintegral numbers are rounded before conversion to hexadecimal format. An Empty value results in "0." A value of Nothing generates an error.

  • The hexadecimal result is limited to 16 digits. Numbers larger than this limit result in an overflow error.

  • If the source value is a string, it may appear in hexadecimal format. Such strings begin with the standard "&H" hexadecimal prefix for Visual Basic, as in "&H10" for a decimal value of 16.

Version Differences

The Visual Basic 6 version of the Hex function only handled up to eight hex digits. The .NET version handles up to 16 digits.

See Also

Oct Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net