Mega Code Archive

 
Categories / VB.Net / Data Types
 

Converts a double-precision floating-point number to a Decimal

Imports System Imports Microsoft.VisualBasic Module DecimalFromDoubleDemo     Sub DecimalFromDouble( argument As Double )         Dim decValue    As Object         ' Convert the Double argument to a Decimal value.         Try             decValue = Decimal.op_Explicit( argument )         Catch ex As Exception             Console.WriteLine( ex )         End Try         Console.WriteLine( decValue )     End Sub      Sub Main( )         DecimalFromDouble( 1.234567890123E-30 )     End Sub  End Module