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

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!
 
K

Kikoz

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.
 
T

TN Bella

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top