Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual Basic
 UShort Data Type
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Basic Language Reference
UShort Data Type (Visual Basic)

Holds unsigned 16-bit (2-byte) integers ranging in value from 0 through 65,535.

Use the UShort data type to contain binary data too large for Byte.

The default value of UShort is 0.

Programming Tips

  • Negative Numbers. Because UShort is an unsigned type, it cannot represent a negative number. If you use the unary minus (-) operator on an expression that evaluates to type UShort, Visual Basic converts the expression to Integer first.

  • CLS Compliance. The UShort data type is not part of the Common Language Specification (CLS), so CLS-compliant code cannot consume a component that uses it.

  • Widening. The UShort data type widens to Integer, UInteger, Long, ULong, Decimal, Single, and Double. This means you can convert UShort to any of these types without encountering a System..::.OverflowException error.

  • Type Characters. Appending the literal type characters US to a literal forces it to the UShort data type. UShort has no identifier type character.

  • Framework Type. The corresponding type in the .NET Framework is the System..::.UInt16 structure.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker