Trying to display the decimal...can someone help?

  • Thread starter Thread starter TN Bella
  • Start date Start date
T

TN Bella

This is what I have working, but I want to display the value like
currency...showing the decimal point and the two points after
it...$8.99.

Thank you!!
Sub AddAcctNums(Source as Object, E as EventArgs)
Dim strControlName As String
Dim i, sum As Int16
sum = 0
For i = 1 To 15
strControlName = "txtAcctNum" & i
Dim TB As TextBox =
CType(Me.FindControl(strControlName), TextBox)
If TB.Text <> "" Then
sum = sum + Val(TB.Text)
End If
Next
txtAcctNumSum.text= sum
End Sub

Shouldn't it look something like this:
txtAcctNumSum.text= sum.Format("{0:c}"), txtAcctNumSum.text)

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
I'm not sure what's in VB but in C# it's like this:

double sum = GetSomeDoubleValue();
txtMyLable.Text = sum.ToString("N");

Look up for correct formatter for ToString method.
 
Okay..I have the decimals and the two values after it, but for some
reason my code is not adding it correctly.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Back
Top