• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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 ?
0
isnoend2001
Asked:
isnoend2001
  • 2
2 Solutions
 
Dan CraciunIT ConsultantCommented:
40 - (-20) = 40 + 20 = 60

HTH,
Dan
0
 
isnoend2001Author Commented:
this works lblCredit = Val(lblCredit) + (Credits)
0
 
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
 
isnoend2001Author Commented:
Thanks
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now