how to convert string to double datatype using VB.net

  • Thread starter Thread starter kadar ali
  • Start date Start date
Family Tree Mike said:
double.TryParse() would be a useful function for this.

dim x as double
if (double.TryParse("3.14159265", out x)) then
Console.WriteLine("Got Pi")
else
Console.WriteLine("Error getting Pi...")
endif

Correction, for VB .NET it is:

Dim pi As Double
If Double.TryParse("3.14159265", pi) Then
Console.WriteLine("Got Pi")
Else
Console.WriteLine("Error getting Pi...")
End If

-Scott
 
Scott M. said:
Correction, for VB .NET it is:

Dim pi As Double
If Double.TryParse("3.14159265", pi) Then
Console.WriteLine("Got Pi")
Else
Console.WriteLine("Error getting Pi...")
End If

-Scott

Oops! Some C# jumped into my vb...

Mike
 
Back
Top