CShort Function In VB.Net

What is CShort Function?

Explanation

CShort Function

CShort Function in Visual Basic.net 2008 is used convert an expression to Short Datatype. This function uses the locale settings of the system for conversion.
Syntax:

CShort(expression)
Example:

Module Module1
Sub Main()
Dim a As Long = 1234.57
Console.WriteLine("The short value for the expression
is:" & CShort(a))
Console.ReadLine()
End Sub
End Module
Result:

The short value for the expression is::1235

In the above CShort Function example, an long expression is converted into short datatype.

Visual Basic Tutorial


Ask Questions

Ask Question