Mega Code Archive

 
Categories / VB.Net / Data Types
 

Converts a Decimal to a 16-bit signed integer

Module DecimalToU_Int16Demo     Public Sub DecimalToU_Int16(argument As Decimal)         Dim Int16Value As Object         Dim UInt16Value As Object         ' Convert the argument to a Short value.         Try             Int16Value = CShort(argument)         Catch ex As Exception              Console.WriteLine(ex.GetType().Name)         End Try         ' Convert the argument to a UShort value.         Try             UInt16Value = CUShort(argument)         Catch ex As Exception             Console.WriteLine(ex.GetType().Name)         End Try         Console.WriteLine(Int16Value)         Console.WriteLine(UInt16Value )     End Sub     Public Sub Main( )         DecimalToU_Int16(123d)     End Sub End Module