VB.NET Question and Recomendation


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: VB.NET Question and Recomendation

  1. #1
    Join Date
    Sep 2005
    Posts
    4

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

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    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!

  3. #3
    Join Date
    Sep 2005
    Posts
    4
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center