homecode zoneQuick Codedownloadssubmit codeabout usfeedbackscontact ussitemap
 
Beginners
Database
File System Object
General
Graphics
Multimedia
Networking
Shell Object
Timer
Array
Date/Time
Declaration
Error Handling
File/Folder
Logic
Loops & Conditional
Math
Miscellaneous
Strings
Values
Pro - Languages
C/C++
Java
Visual basic
asp
vb.net 2003/2005
asp.net
Quick Code
SUBMIT CODE
Mail List
LINKS
Submit LINK
 
ProgrammerGuide.net - VB Math.
Home » VB Zone » Math

Val function

Description
Returns the numbers contained in a string as a numeric value of appropriate type.

Syntax: Val(string)

The required string argument is any valid string expression.

The Val function stops reading the string at the first character it can't recognize as part of a number. Symbols and characters that are often considered parts of numeric values, such as dollar signs and commas, are not recognized. However, the function recognizes the radix prefixes &O (for octal) and &H (for hexadecimal). Blanks, tabs, and linefeed characters are stripped from the argument.

Round

Description
Returns a number rounded to a specified number of decimal places.

Syntax: Round(expression [,numdecimalplaces])

The Round function syntax has these parts:

Part Description
expression Required. Numeric expression being rounded.
numdecimalplaces Optional. Number indicating how many places to the right of the decimal are included in the rounding. If omitted, integers are returned by the Round function.

Example
Text1.Text = Number
Round(Number,5) 'Rounds the number in text1 to 5 decimal places

Int and Fix functions

Returns the integer portion of a number.

Syntax: Int(number), Fix(number)

The required number argument is a Double or any valid numeric expression. If number contains Null, Null is returned.

Both Int and Fix remove the fractional part of number and return the resulting integer value. The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example,Int converts -8.4 to -9, and Fix converts -8.4 to -8.

Rnd and Randomize functions

A function which generates a random number.
Randomize uses number to initialize the Rnd function's random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.

Syntax: Randomize [number], Rnd[(number)]

Example:
Randomize
Label1 = Int((6 * Rnd) + 1) 'Generate random value between 1 and 6.

Sgn function

Returns a Variant (Integer) indicating the sign of a number.

Syntax: Sgn(number)

The required number argument can be any valid numeric expression.

 


« Previous 1 2 Next »

Viewers: 13
Visitors:127291
Last Updated on:Sunday, January 17, 2010
Home | About us | Feedback | Contact us | Sitemap
Copyright © 2008 ProgrammerGuide.net. All rights reserved.
This site is best viewed in IE 6.0, Firefox 1.5 and above with screen resolution of 1024 X 768.