-
VB.NET Question and Recomendation
Hi. I a begginer using VB.NET. Im making a project which is a change calculator (money).
I have two TextBoxes were in one I put the purchase price and in the other the amount tendered. The format to enter it is like this string : 1852 (knowing that i mean $18.52)
The problem is what can I use to take that string of numbers and display in my LISTBOX (lstresults) in the format of money, in order that I can put any amount of number (money) and it will know were to put the decimal point "."
to divide the cents with the dollars.
Example:
_______________________________________________________________
Purchase Price: 1852 (format entered in the TextBox)
Results:
_________________________________________
| Purchase price is: $18.52
| Amount Tendered: .......
| .
| .
-
Try this:
Dim PurchasePrice As String = "1852"
lstResults.Items.Add("Purchase price is: " & Format(Val(PurchasePrice) / 100, "Currency"))
To understand how that works, look up the Val and Format functions in VB's online help.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Thanks a lot. It work perfect.
Im looking forward to read more about Val and Format functions
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks