Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToDecimal (String) converts string to decimal number

Module Example    Public Sub Main()     Dim stringVal As String ="123123.123123"     Dim decimalVal As Decimal = 0     Try         decimalVal = System.Convert.ToDecimal(stringVal)         System.Console.WriteLine("The string as a decimal is {0}.",decimalVal)     Catch exception As System.Exception         System.Console.WriteLine("Exception")     End Try     stringVal = System.Convert.ToString(decimalVal)     System.Console.WriteLine("The decimal as a string is {0}.",stringVal)    End Sub End Module