Mega Code Archive

 
Categories / VB.Net / Data Types
 

Single TryParse Method converts string to single-precision floating-point number

Module Example    Public Sub Main()         Dim value As String         Dim number As Single                  ' Parse a floating-point value with a thousands separator.         value = "1,234.56"         If Single.TryParse(value, number) Then            Console.WriteLine(number)         Else            Console.WriteLine("Unable to parse '{0}'.", value)               End If        End Sub End Module