Results 1 to 4 of 4

Thread: Text Box Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2007
    Posts
    25

    Text Box Help

    I am creating a concrete yard calculator and need the results to show the decimal places. What type of variable should I declare and if it is an integer what do I have to do to the textbox for it to show the first 2 decimal places without it rounding. It is rounding up or down right now from .50.

    -NUStudent-

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Text Box Help

    vb Code:
    1. dim number as decimal = 100.50
    2. textbox1.text = number.tostring("0.00")

  3. #3
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: Text Box Help

    Did that help? If so, please mark the thread resolved.
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  4. #4
    Hyperactive Member gnaver's Avatar
    Join Date
    Jul 2005
    Location
    Denmark/Sweden
    Posts
    289

    Re: Text Box Help

    or like this

    vb Code:
    1. Dim number As Decimal = 100.443456
    2. TextBox1.Text = String.Format("{0:n2}", number)

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