Mega Code Archive

 
Categories / VB.Net / Data Types
 

Converts a Decimal to a 32-bit signed integer

Module DecimalToU_Int32Demo     Public Sub DecimalToU_Int32(argument As Decimal)         Dim Int32Value As Object         Dim UInt32Value As Object         ' Convert the argument to an int value.         Try             Int32Value = CInt(argument)         Catch ex As Exception              Console.WriteLine(ex.GetType().Name)         End Try         ' Convert the argument to a uint value.         Try             UInt32Value = CUInt(argument)         Catch ex As Exception             Console.WriteLine(ex.GetType().Name)         End Try         Console.WriteLine(Int32Value)         Console.WriteLine(UInt32Value)     End Sub     Public Sub Main( )         DecimalToU_Int32( 123d)     End Sub End Module