Math
 

VB also provides built-in functions which can act on variables. Most are self-explanatory. In my experience, the VAL, RND, and ROUND functions are among the most valuable, so be sure to pay close attention to them!



  • Round - Rounds a number to a selectable number of decimal places
    result = round ( tempvariable,2 )

  • Val - Returns the numerical content of a string
    result = Val ("123.4")

  • Int - Returns an integer by truncating (different than Fix) 
     i  = int ( tempvariable )

  • Fix - Returns an integer by truncating (different than Int) 
     i  = fix ( tempvariable )

  • Hex - Returns the hexadecimal value of any number
    temp$ = hex ( tempvariable )

  • Oct - Returns the octal value of any number
    temp$ = oct ( tempvariable )

    Tan - Returns the tangent of an angle

  • tempvariable1 = tan ( tempvariable2 )

    Rnd - Returns a random number between 0 and 1

  • tempvariable1 = rnd

  • Randomize - Initializes the Rnd function so it gives different answers each time
    randomize

  • Sgn - Returns the sign of a number 
     i  = sgn ( tempvariable )

  • Sin - Returns the sine of an angle
    tempvariable1 = sin ( tempvariable2 )

  • Cos - Returns the cosine of an angle
    tempvariable2 = cos ( tempvariable )

  • Abs - Converts a number to a positive value 
     i  = abs ( tempvariable )

  • Sqr - Returns the square root of a number
    tempvariable1 = sqr ( tempvariable2 )

  • Log - Returns the base 10 logarithm of a number
    tempvariable1 = log ( tempvariable2 )

  • Atn - Returns the arctangent of an angle
    tempvariable1 = atn ( tempvariable )

  • Partition - Sort of an oddball function but segregates values according to ranges 
     

  • Type Conversions - A variety of conversion functions 

    CBool , CByte, CCur, CDate, CDbl, CDec, CInt, CLng, CSng, CStr, CVar

VB also provides built-in functions which can act on variables. Most are self-explanatory. In my experience, the VAL, RND, and ROUND functions are among the most valuable, so be sure to pay close attention to them!



  • Round - Rounds a number to a selectable number of decimal places
    result = round ( tempvariable,2 )

  • Val - Returns the numerical content of a string
    result = Val ("123.4")

  • Int - Returns an integer by truncating (different than Fix) 
     i  = int ( tempvariable )

  • Fix - Returns an integer by truncating (different than Int) 
     i  = fix ( tempvariable )

  • Hex - Returns the hexadecimal value of any number
    temp$ = hex ( tempvariable )

  • Oct - Returns the octal value of any number
    temp$ = oct ( tempvariable )

  • Tan - Returns the tangent of an angle
    tempvariable1 = tan ( tempvariable2 )

  • Rnd - Returns a random number between 0 and 1
    tempvariable1 = rnd

  • Randomize - Initializes the Rnd function so it gives different answers each time randomize

  • Sgn - Returns the sign of a number 
     i  = sgn ( tempvariable )

  • Sin - Returns the sine of an angle
    tempvariable1 = sin ( tempvariable2 )

  • Cos - Returns the cosine of an angle
    tempvariable2 = cos ( tempvariable )

  • Abs - Converts a number to a positive value 
     i  = abs ( tempvariable )

  • Sqr - Returns the square root of a number
    tempvariable1 = sqr ( tempvariable2 )

  • Log - Returns the base 10 logarithm of a number
    tempvariable1 = log ( tempvariable2 )

  • Atn - Returns the arctangent of an angle
    tempvariable1 = atn ( tempvariable )

  • Partition - Sort of an oddball function but segregates values according to ranges 
     

  • Type Conversions - A variety of conversion functions 
     CBool , CByte, CCur, CDate, CDbl, CDec, CInt, CLng, CSng, CStr, CVar

(c) Shilpa Sayura Foundation 2006-2017