Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToString (Double) converts double-precision floating-point number to string

Class Sample    Public Shared Sub Main()     Dim doubleVal As Double = 1.2     Dim stringVal As String     stringVal = System.Convert.ToString(doubleVal)     System.Console.WriteLine("{0} as a String is: {1}",doubleVal, stringVal)     Try         doubleVal = System.Convert.ToDouble(stringVal)         System.Console.WriteLine("{0} as a Double is: {1}",stringVal, doubleVal)     Catch exception As System.OverflowException         System.Console.WriteLine("OverflowException")     Catch exception As System.FormatException         System.Console.WriteLine("FormatException")     Catch exception As System.ArgumentException         System.Console.WriteLine("The string is null.")     End Try     End Sub  End Class