Format Number pada visual studio
Expression | Result |
FormatNumber(1.23456, 2) | 1.23 |
FormatNumber(0.123456, 2, TriState.False) | .12 |
FormatNumber(0.123456, 2, TriState.True) | 0.12 |
FormatNumber(-12345.12, , TriState.False) | -12,345.12 |
FormatNumber(-12345.12, , TriState.True) | (12,345.12) |
FormatNumber(-12345.12, , TriState.True, TriState.False) | (12345.12) |
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
Dim txt As String
Dim x As Single
x = 1.23456
txt &= "FormatNumber(" & x.ToString() & ", 2) = " & _
FormatNumber(x, 2) & vbCrLf
x = 0.123456
txt &= "FormatNumber(" & x.ToString() & ", 2, " & _
"TriState.False) = " & FormatNumber(x, 2, _
TriState.False) & vbCrLf
txt &= "FormatNumber(" & x.ToString() & ", 2, " & _
"TriState.True) = " & FormatNumber(x, 2, _
TriState.True) & vbCrLf
x = -12345.12345
txt &= "FormatNumber(" & x.ToString() & ", , " & _
"TriState.False) = " & FormatNumber(x, 2, , _
TriState.False) & vbCrLf
txt &= "FormatNumber(" & x.ToString() & ", , " & _
"TriState.True) = " & FormatNumber(x, 2, , _
TriState.True) & vbCrLf
txt &= "FormatNumber(" & x.ToString() & ", , " & _
"TriState.True, TriState.False) = " & _
FormatNumber(x, 2, , TriState.True, TriState.False) _
& vbCrLf
txtResult.Text = txt
txtResult.Select(0, 0)
End Sub
Semoga Bermanfaat
Postingan terkait:
Belum ada tanggapan untuk "Format Number VB.NET"
Posting Komentar