Results 1 to 8 of 8

Thread: vb.net

  1. #1
    Yorkshire Grit optispares's Avatar
    Join Date
    May 2000
    Location
    harrogate,north yorks.U.K.
    Occupation
    Other Optical Manufacturer or Vendor
    Posts
    557

    vb.net

    :hammer: anybody using vb.net ? if so can u tell me how to limit the numbers after the decimal point displayed in the answer text box other than reducing the size of the box .
    http://www.optispares.btinternet.co.uk

    jack


    It is by universal misunderstanding that all agree. For if, by ill luck, people understood each other, they would never agree.

  2. #2
    Bad address email on file QDO1's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Occupation
    Dispensing Optician
    Posts
    1,961
    try this...

    Dim oldValue as String
    Dim newValue as string
    oldValue = "3.141592654"
    newValue = FormatNumber(oldValue, 2, , , TriState.False)


    newValue now equals "3.14"


  3. #3
    Yorkshire Grit optispares's Avatar
    Join Date
    May 2000
    Location
    harrogate,north yorks.U.K.
    Occupation
    Other Optical Manufacturer or Vendor
    Posts
    557
    Quote Originally Posted by QDO1
    try this...

    Dim oldValue as String
    Dim newValue as string
    oldValue = "3.141592654"
    newValue = FormatNumber(oldValue, 2, , , TriState.False)


    newValue now equals "3.14"
    not sure if i follow this my old value is not a constant as it is the answer to an equation so it is variable. i just want it to dispay as say eg. 3.25 rather than 3.2496751234
    http://www.optispares.btinternet.co.uk

    jack


    It is by universal misunderstanding that all agree. For if, by ill luck, people understood each other, they would never agree.

  4. #4
    Yorkshire Grit optispares's Avatar
    Join Date
    May 2000
    Location
    harrogate,north yorks.U.K.
    Occupation
    Other Optical Manufacturer or Vendor
    Posts
    557

    Even Simpler

    Quote Originally Posted by QDO1
    try this...

    Dim oldValue as String
    Dim newValue as string
    oldValue = "3.141592654"
    newValue = FormatNumber(oldValue, 2, , , TriState.False)


    newValue now equals "3.14"
    ORIGINAL


    TextBox6.Text = Answer
    JUST NEEDED TO ADD
    TextBox6.Text = Answer .ToString("F")

    http://www.optispares.btinternet.co.uk

    jack


    It is by universal misunderstanding that all agree. For if, by ill luck, people understood each other, they would never agree.

  5. #5
    Bad address email on file QDO1's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Occupation
    Dispensing Optician
    Posts
    1,961
    Quote Originally Posted by optispares
    ORIGINAL


    TextBox6.Text = Answer
    JUST NEEDED TO ADD
    TextBox6.Text = Answer .ToString("F")

    sweet

  6. #6
    Master OptiBoarder Darryl Meister's Avatar
    Join Date
    May 2000
    Location
    Kansas City, Kansas, United States
    Occupation
    Lens Manufacturer
    Posts
    3,700
    You should check out the Format$ method, too (assuming they still offer it in .Net). It will format numbers in a variety of ways and then convert them directly to a string. It's probably the simplest and most flexible solution. Of course, you can also round numbers to a given decimal place using the Round method.
    Darryl J. Meister, ABOM

  7. #7
    Bad address email on file QDO1's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Occupation
    Dispensing Optician
    Posts
    1,961
    out of interest - what developer software is every one using?

  8. #8
    Master OptiBoarder Darryl Meister's Avatar
    Join Date
    May 2000
    Location
    Kansas City, Kansas, United States
    Occupation
    Lens Manufacturer
    Posts
    3,700
    I, personally, just use Microsoft's Visual Basic 6.0 and just a basic text editor for web programming.
    Darryl J. Meister, ABOM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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