VB integer to string

To convert an integer value to a string that represent the integer value, you need to use toString(formatstring) method.

Module Module1
   Sub Main()
     Dim inValue As Integer
     Dim strValue As String
     Dim strValue1 As String
     inValue = 1235
     strValue = inValue.ToString("D") 'D indicates converson from integer value.
     strValue1 = inValue.ToString("N") 'N indicates conversion from a number.
     'if you want to the result string to dispaly thousand separator (,), use N rather than D.
     Console.WriteLine(strValue)
     Console.WriteLine(strValue1)
    
     Console.ReadLine()
   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.