CUShort Function in VB.NET

How to use CUShort Function?

Explanation

CUShort Function

CUShort Function in Visual Basic.net 2008 is used to hold a 16-bit integer ranging from from 0 to 65,535.The default held by this datatype is zero and the fractional parts are rounded.
Syntax:

CUShort(expression)
Example:

Module Module1
Sub Main()
Dim dble As Double = 162.57
Dim shrt As Short
shrt = CUShort(dble)
Console.WriteLine("16 bit unsigned short value is::" & shrt)
Console.ReadLine()
End Sub
End Module
Result:

16 bit unsigned short value is:: 163

In the above CUShort Function example, an expression of type Double is converted to an 16-bit unsigned short integer using the CUShort().

Visual Basic Tutorial


Ask Questions

Ask Question