Ok what I am trying to do is show 2 decimal places...
For Example:
1.20 not 1.2 --- Below is my Code... can anyone help me here?
Dim Amount As Double
Amount = 1.20
'Display Amount
lblAmount.Text = "$" + Amount.ToString()
Printable View
Ok what I am trying to do is show 2 decimal places...
For Example:
1.20 not 1.2 --- Below is my Code... can anyone help me here?
Dim Amount As Double
Amount = 1.20
'Display Amount
lblAmount.Text = "$" + Amount.ToString()
You just have to format it to what you want, try changing the last line to this and see if it works.
Code:'Display Amount
lblAmount.Text = Amount.ToString("$ ##.00")
Worked Great Thanks!
Anjari
This will obviously work and display: $12,345Code:Dim Amount As Integer = "12345"
Label1.Text = "$" & Amount.ToString("##,###")
But What if the Amount varible is already as String, example:
The above will now give an error so how would you format the varible that's already a string the vb.net way?Code:Dim Amount As String = "12345"
Label1.Text = "$" & Amount.ToString("##,###")
Hello JustAProg,
Well, here is a workaround of sorts.....
VB Code:
Dim Amount As String = "12345" Amount = "$" & Format(Convert.ToInt64(Amount), "###,###,###.00") MsgBox(Amount)