VB double to string

By using toString(formatstring) method you can convert a double value to a string to display in a specific format.
Module Module1
   Sub Main()
     Dim dValue As Double
     Dim strValue As String
     Dim strValue1 As String
     dValue = 123333.455643
     strValue = dValue.ToString("F03") 'F indicates conversion from floating-point value.
     '03 indicates three decimal places to show in result string. If you want to display five decimal places
     'write 05.
     strValue1 = dValue.ToString("N04") 'N indicates conversion from a number.
     'if you want to dispaly thousand separator, use N rather than F.
  End Sub
End Module

Posted by: Ly Meng | post date: 02-06-2013 | Subject: VB.NET Programming Language

This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.