gchq
Well-known member
- Joined
- Dec 14, 2007
- Messages
- 168
- Programming Experience
- 10+
This is a really odd one! This has worked without incident, now it would appear that two numbers that add up to a total do not!!
I've checked and rechecked . vNet is returning 560.23 - vTax is returning 41.32 and vTotal is returning 601.55 - according to my maths that is correct, but it's not passing the if function
Any ideas?
Thanks
Update - tried it this way as well
The messagebox is returning 601.55 for both vTotal and vRunTotal and yet it's still getting caught in the If statement! This one is REALLY driving me up the proverbial wall......
VB.NET:
Dim vNet As Double = AmountNetTB.Text
Dim vTax As Double = AmountSalesTaxTB.Text
Dim vTotal As Double = AmountTotalTB.Text
AppBox.Show(vNet.ToString & " " & vTax.ToString & " " & vTotal.ToString & " - " & vNet + vTax, MessageBoxButtons.OK, MessageBoxIcon.Information)
If Not vTotal = (vNet + vTax) Then
Return "The invoice total doesn't balance with the Sales Tax and the Net amount!"
End If
I've checked and rechecked . vNet is returning 560.23 - vTax is returning 41.32 and vTotal is returning 601.55 - according to my maths that is correct, but it's not passing the if function
Any ideas?
Thanks
Update - tried it this way as well
VB.NET:
Dim vNet As Double = AmountNetTB.Text
Dim vTax As Double = AmountSalesTaxTB.Text
Dim vTotal As Double = AmountTotalTB.Text
Dim vRunTotal As Double = vNet + vTax
If vTotal <> vRunTotal Then
AppBox.Show(vTotal & " - " & vRunTotal, MessageBoxButtons.OK, MessageBoxIcon.Information)
Return "The invoice total doesn't balance with the Sales Tax and the Net amount!"
End If
The messagebox is returning 601.55 for both vTotal and vRunTotal and yet it's still getting caught in the If statement! This one is REALLY driving me up the proverbial wall......
Last edited: