Results 1 to 2 of 2

Thread: Code to format currency in a text box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2001
    Location
    Botswana
    Posts
    21

    Cool Code to format currency in a text box

    To all of you.

    Please assist, i'm looking for a code that will format contents of a text box to ($0.00/sqm).

    I have a text box txtprice, when a user types in 20.00, it should automaticall display $20.00/sqm.

    Your help will be mostly appreciated.
    Genie

  2. #2
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Hi
    I think u may be the first from Botswana!! Welcome..

    U could use a Masked Edit Box to control the input but that control is usually a lot more trouble than it is worth... a simpler way would be to change the value to the correct format in the validate event of the textbox eg

    VB Code:
    1. Private Sub Text1_Validate(Cancel As Boolean)
    2.     Text1.Text = Format$(Text1.Text, "currency") & "/sqm"
    3. End Sub
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width