|
-
May 11th, 2002, 10:10 AM
#1
Thread Starter
Junior Member
Display currency fields
I have a some textboxes on a form in which the user will enter some numbers. These values correspond to dollar amounts, which I want the user to see, so I put the following code in the textchange event:
VB Code:
txtTextbox1.text = FormatCurrency(txtTextbox1.text)
This works fine. It formats it just the way I want with the $ and everything.
The problem is that when I want to use the value in that textbox for a calculation, I have to use the following code:
VB Code:
txtTotal = FormatCurrency(Val(Mid(txtTextbox1.Text, 2)) + Val(Mid(txtTextbox2.Text, 2)))
I have to use the Mid function just to get the "$" off the front so that it will add correctly. Is there an easier way to do this? I thought of using the Masked Edit Control, but I haven't figured out how to get that as an option in VB.NET. But even if I did, I don't know if it is the best way to solve my problem. Any ideas?
Thanks from this .Net newbie.
LDD
----------------
"Character is what you do in the dark." Dwight L. Moody
-
May 13th, 2002, 06:45 AM
#2
Hyperactive Member
wouldn't you just say dim Mytotal as decimal = CDec(Textbox1.text)????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|