Format a negative integer or floating-point number in Number format : Console Format « Development « VB.Net






Format a negative integer or floating-point number in Number format

 
Imports System
Imports Microsoft.VisualBasic

Class Sample

   Public Shared Sub Main()
      Console.WriteLine("(C) Currency: . . . . . . . . {0:C}" & vbCrLf & _
                        "(D) Decimal:. . . . . . . . . {0:D}" & vbCrLf & _
                        "(E) Scientific: . . . . . . . {1:E}" & vbCrLf & _
                        "(F) Fixed point:. . . . . . . {1:F}" & vbCrLf & _
                        "(G) General:. . . . . . . . . {0:G}" & vbCrLf & _
                        "    (default):. . . . . . . . {0} (default = 'G')" & vbCrLf & _
                        "(N) Number: . . . . . . . . . {0:N}" & vbCrLf & _
                        "(P) Percent:. . . . . . . . . {1:P}" & vbCrLf & _
                        "(R) Round-trip: . . . . . . . {1:R}" & vbCrLf & _
                        "(X) Hexadecimal:. . . . . . . {0:X}" & vbCrLf, _
                        - 123, - 123.45F)

   End Sub
End Class

   
  








Related examples in the same category

1.Format a negative integer or floating-point number in Currency format
2.Format a negative integer or floating-point number in Decimal format
3.Format a negative integer or floating-point number in Scientific format
4.Format a negative integer or floating-point number in Fixed point format
5.Format a negative integer or floating-point number in General format
6.Format a negative integer or floating-point number in default format
7.Format a negative integer or floating-point number in Percent format
8.Format a negative integer or floating-point number in Round-trip format
9.Format a negative integer or floating-point number in Hexadecimal format
10.Format the current date in (d) Short date
11.Format the current date in (D) Long date
12.Format the current date in (t) Short time
13.Format the current date in (T) Long time
14.Format the current date in (f) Full date/short time
15.Format the current date in (F) Full date/long time
16.Format the current date in (g) General date/short time
17.Format the current date in (G) General date/long time
18.Format the current date in (M) Month
19.Format the current date in (R) RFC1123
20.Format the current date in (s) Sortable
21.Format the current date in (u) Universal sortable
22.Format the current date in (U) Universal full date/time
23.Format the current date in (Y) Year
24.Format a Color enumeration value in (G) General
25.Format a Color enumeration value in (default)
26.Format a Color enumeration value in (F) Flags
27.Format a Color enumeration value in (D) Decimal number
28.Format a Color enumeration value in (X) Hexadecimal