vb6 displaying wrong calculation

Dim Credits As Long
lblCredit = 40
Credits = -20
lblCredit = Val(lblCredit) - (Credits)
lblCredit displays 60 instead of 20
The lblCredit is increased by 20, but should be reduced by 20
what is wrong ?
isnoend2001Asked:
Who is Participating?
 
aikimarkCommented:
basic math: subtracting a negative number becomes addition.

state your problem out loud:
If I remove a drain of 20 from my equation/system, what will the new value be?
0
 
Dan CraciunIT ConsultantCommented:
40 - (-20) = 40 + 20 = 60

HTH,
Dan
0
 
isnoend2001Author Commented:
this works lblCredit = Val(lblCredit) + (Credits)
0
 
isnoend2001Author Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.