Results 1 to 3 of 3

Thread: Newbie needs help rounding a number

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Moose Jaw
    Posts
    4

    Talking

    Hi all

    I am writing a program to calculate table sizes for SQL Servers. I have all the equation stuff right, but I need to be able to round a number as such:

    1.1 = 1
    1.9 = 1
    2.6 = 2
    2.2 = 2

    Do you see, if it is a decimal number it must always round down so if my variable equals 2 point anything it must equal 2. Hope somebody can help I'm just new at this but I really am liking it.

    Thanks, Justin

  2. #2
    Member
    Join Date
    Jul 2000
    Location
    Ontario, Canada
    Posts
    61
    Just get the left most character like this
    Code:
    text1.text = Left(text1.text, 1)
    ---~^ Absalom ^~---

    There is nobody in the world who knows everything there is no one his/her workforce who knows everything what really makes the person smart is that he/she is not affraid to ask for help.

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    the best way is to use the Fix function


    Code:
    MyVar = Fix{MyVar)
    this will take off the decimal part of it

    you could also use the Int Function which does the same thing

    Code:
    MyVar = Int{MyVar)


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