VB.NET Absolute value

  • Thread starter Thread starter Bill Nguyen
  • Start date Start date
B

Bill Nguyen

How do I get the absolute value of an expression in VB.NET? The new ABS
function looks scary to me!

Thanks
Bill
 
Bill Nguyen said:
How do I get the absolute value of an expression in VB.NET? The new
ABS function looks scary to me!

Why scary?

value2 = math.abs(value1)
 
Bill,
How do I get the absolute value of an expression in VB.NET?
Have you tried System.Math.Abs?
The new ABS
function looks scary to me!
Or are you referring to a different ABS function?


Dim x As Integer
x = Math.Abs(-1)

Alternatively you can import System.Math:

Imports System.Math

Dim x As Integer
x = Abs(-1)

Hope this helps
Jay
 
System.Math.Abs(<numeric expression here>)

What's scary about it? :-)

-Rob Teixeira [MVP]
 
* "Bill Nguyen said:
How do I get the absolute value of an expression in VB.NET? The new ABS
function looks scary to me!

?!?

\\\
d = Math.Abs(...)
///
 
Back
Top