VB.NET Language in a Nutshell

   
CShort Function

Named Arguments

No

Syntax

CShort( expression )

expression (required; Numeric or String)

The range of expression is -32,768 to 32,767; fractions are rounded.

Return Value

expression cast as a Short

Description

Converts expression to a Short value; any fractional portion of expression is rounded.

Rules at a Glance

Example

Dim iMyNumber as Short If IsNumeric(sMyNumber) then iMyNumber = CShort(sMyNumber) End If

Programming Tips and Gotchas

VB.NET/VB 6 Differences

The CShort function is new to VB.NET. However, it corresponds directly to the VB 6 CInt function, since both return 16-bit integers.

See Also

CInt Function, CLng Function

   

Категории