|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Byte Data Type (Visual Basic)
Holds unsigned 8-bit (1-byte) integers ranging in value from 0 through 255.
Use the Byte data type to contain binary data.
The default value of Byte is 0.
Negative Numbers. Because Byte is an unsigned type, it cannot represent a negative number. If you use the unary minus (-) operator on an expression that evaluates to type Byte, Visual Basic converts the expression to Short first.
Format Conversions. When Visual Basic reads or writes files, or when it calls DLLs, methods, and properties, it can automatically convert between data formats. Binary data stored in Byte variables and arrays is preserved during such format conversions. You should not use a String variable for binary data, because its contents can be corrupted during conversion between ANSI and Unicode formats.
Widening. The Byte data type widens to Short, UShort, Integer, UInteger, Long, ULong, Decimal, Single, or Double. This means you can convert Byte to any of these types without encountering aerror.
Type Characters. Byte has no literal type character or identifier type character.
Framework Type. The corresponding type in the .NET Framework is thestructure.