Decimal.TryParse Method Converts string to Decimal : Decimal Parse « Data Types « VB.Net






Decimal.TryParse Method Converts string to Decimal

  

Imports System
Imports Microsoft.VisualBasic

Module MainClass
    Sub Main( )

        Dim value As String
        Dim number As Decimal
        
        value = "1,643.57"
        If Decimal.TryParse(value, number) Then
           Console.WriteLine(number)
        Else
           Console.WriteLine("Unable to parse '{0}'.", value)      
        End If   
    End Sub 
End Module 

   
    
  








Related examples in the same category

1.Decimal.Parse Method Converts string to Decimal using the specified style and culture-specific format.
2.Parse string using "." as the thousands separator and " " as the decimal separator.
3.Decimal.TryParse Method (String, NumberStyles, IFormatProvider, Decimal)