Convert.ToDouble (Decimal) converts decimal number to double-precision floating-point number. : Convert to Double « Development « VB.Net






Convert.ToDouble (Decimal) converts decimal number to double-precision floating-point number.

  


Module Example
   Public Sub Main()
    Dim decimalVal As Decimal = 123123.123123

    Dim doubleVal As Double

    ' Decimal to Double conversion cannot overflow.
    doubleVal = System.Convert.ToDouble(decimalVal)
    System.Console.WriteLine("{0} as a Double is: {1}",decimalVal, doubleVal)

    ' Conversion from Double to Decimal can overflow.
    Try
       decimalVal = System.Convert.ToDecimal(doubleVal)
       System.Console.WriteLine("{0} as a Decimal is: {1}",doubleVal, decimalVal)
    Catch exception As System.OverflowException
        System.Console.WriteLine("Overflow in Double-to-Decimal conversion.")
    End Try
   End Sub
End Module

   
    
  








Related examples in the same category

1.Convert.ToDouble (Int16) converts specified 16-bit signed integer to double-precision floating-point number.
2.Convert.ToDouble (Int32) converts 32-bit signed integer to double-precision floating-point number.
3.Convert.ToDouble (Int64) converts 64-bit signed integer to double-precision floating-point number.
4.Convert.ToDouble (Object) converts object to a double-precision floating-point number.
5.Convert.ToDouble (SByte) converts 8-bit signed integer to double-precision floating-point number.
6.Convert.ToDouble (Single) converts single-precision floating-point number to double-precision floating-point number.
7.Convert.ToDouble (String) converts string to double-precision floating-point number.
8.Convert.ToDouble (String, IFormatProvider) converts string to double using culture-specific format
9.Convert.ToDouble (UInt16) converts 16-bit unsigned integer to double-precision floating-point number.
10.Convert.ToDouble (UInt32) converts 32-bit unsigned integer to double-precision floating-point number.
11.Convert.ToDouble (UInt64) converts 64-bit unsigned integer to double-precision floating-point number.