Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem adding textboxes together and view as currency

Status
Not open for further replies.

at51178

Technical User
Mar 25, 2002
587
US
Hi

I am creating a form and would like to have the results how up as a currency value but every time I run my code it keeps freezing not sure why.

--Code --

Dim Add1 As Decimal
Dim Add2 As Decimal
Dim Total As Decimal

Add1 = Me.Text1.Text
Add2 = Me.Text2.Text
Total = Me.Text3.Text

Total = Me.Text1 + Me.Text2
-- End Code --

I am not sure though how to format it as currency
some sites that i have been to said to use this method but it does not work.
Format(Total,"Currency")

Thanks

 
I'm kinda confussed by what your code is doing. I'm pretty sure it is not what you want though.

If you have 2 values:
Code:
dim Total as Decimal
Total = Value1 + Value2

text2.text = format(Total,"Currency")

If you want to take the values from 2 text boxes:
Code:
dim Total as Decimal
Total = double.Parse(Text1.text) + double.Parse(Text2.Text)

text2.text = format(Total,"Currency")

-Rick


----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top