SyntaxDim result As Short = CShort(expression)
DescriptionThe CShort function converts expression to the Short data type; any fractional portion of expression is rounded. Usage at a Glance
ExampleDim targetNumber As Short If IsNumeric(stringNumber) Then targetNumber = CShort(stringNumber) End If Version DifferencesThe CShort function is new to VB under .NET. However, it corresponds directly to the VB 6 CInt function, since both return 16-bit integers. See AlsoCInt Function, CLng Function, CUShort Function |