C
CSharp
C++
Java
Visual Basic
HTML - CSS
Android
Asp
Asp.Net
Php
Python
JavaScript
SQL
XML
Assembly
ActiveX
API
Code Snippets
Database
Files Directories Drives
Forms
Graphics Games
Multimedia
Strings
Windows and Controls
More...
Visual Basic > API and Miscellaneous sample source codes
Visual Basic Code > Function to round a value up,down,or near to another value.
Function to round a value up,down,or near to another value. Function doRound(value As Double, RStep As Double, Mode As String) As Double ' Mode function ' UP RoundUp ' DN RoundDN ' NE Nearest ' If Mode = "DN" Then doRound = (Int(value / RStep) * RStep) Exit Function End If ' **** mode up If Mode = "UP" Then If value Mod RStep > 0 Then doRound = ((Int(value / RStep) * RStep) + RStep) Else doRound = value End If Exit Function End If If Mode = "NE" Then value = value + (RStep / 2) doRound = (Int(value / RStep) * RStep) Exit Function End If End Function
Privacy Policy
|
Contact
|
Advertising
|
Link to Us
|
Directory