Cool Visual Basic
 
Main
Frequently Asked Questions
VB Helpdesk
Message Boards
Library
Downloads
View Guestbook
Add to Guestbook
Product Reviews
Bookstore
Links
Newsgroups
Vendors
Affiliates
Cooltech.org

Cool VB FAQ


Text Format

The best Visual Basic FAQ(Frequently Asked Quesitions) file on the internet. Do you have a problem that's got you stumped? Do you have the answer to one? We've done our best to make this the best resources for the questions and the answers. Post a question, or a answer to one, by sending email to VBQA@beadsandbaubles.com.

      Root

            Math

  • I process customer orders, and they come in batches of tens. I need to round a number to the closest 10, but I can only round up. Otherwise, the user won't have sufficent product. How can I do this? Plus, is there anyway to round down?

    Compatibility:VB3  VB4  VB5

    Use these functions:

    Function RoundUp(byVal Value as long, Round as long)
           RoundUp = ((Value \ Round) + Sgn(Value Mod Round)) * 5
    End Function
    
    Function RoundDown(byVal Value as long, Round as long)
           RoundUp = Value  -  (Value mod Round)
    End Function
    

     

     

    LinkExchange
    LinkExchange Member Free Home Pages at GeoCities


    Copyright 2000, David J Berube<Form1@aol.com>. All Rights Reserved.