Link to home
Start Free TrialLog in
Avatar of JMO9966
JMO9966

asked on

VB.Net is there a function to return the difference between two values?

I need to compare a zero or greater value to a value that may be negative and return the difference between the two values as a positive number  these variables are all stored as data type Double.
 
For example:  

Value 1 = 17
Value 2 = -4

Would like function to return 21.

Thanks,
Jon
ASKER CERTIFIED SOLUTION
Avatar of ptakja
ptakja
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JMO9966
JMO9966

ASKER

I ended up turning the negative number value2 into a positive and adding to value1.

If FutureBalance < OrderPoint And FutureBalance < 0 Then
            FutureSuggOrder = Math.Abs(FutureBalance) + OrderPoint
        ElseIf FutureBalance < OrderPoint And FutureBalance >= 0 Then
            FutureSuggOrder = OrderPoint - FutureBalance
        Else
            FutureSuggOrder = 0
        End If