Mega Code Archive

 
Categories / VB.Net Tutorial / Data Type
 

Numeric format

Public Class Tester     Public Shared Sub Main         Dim intValue As Integer = 1234567         Dim floatValue As Double = Math.PI         Dim result As New System.Text.StringBuilder         result.AppendLine(String.Format("{0}  ...  {1}", _            intValue, floatValue))         result.AppendLine(String.Format("{0:N}  ...  {1:E}", _            intValue, floatValue))         result.AppendLine(intValue.ToString("N5") & "  ...  " & _            floatValue.ToString("G5"))         Console.WriteLine(result.ToString())       End Sub End Class 1234567 ... 3.14159265358979 1,234,567.00 ... 3.141593E+000 1,234,567.00000 ... 3.1416