Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

vb6 displaying wrong calculation

Posted on 2014-01-12
4
Medium Priority
?
204 Views
Last Modified: 2014-01-12
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
Comment
Question by:isnoend2001
  • 2
4 Comments
 
LVL 35

Assisted Solution

by:Dan Craciun
Dan Craciun earned 1000 total points
ID: 39775731
40 - (-20) = 40 + 20 = 60

HTH,
Dan
0
 

Author Comment

by:isnoend2001
ID: 39775733
this works lblCredit = Val(lblCredit) + (Credits)
0
 
LVL 46

Accepted Solution

by:
aikimark earned 1000 total points
ID: 39775734
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
 

Author Closing Comment

by:isnoend2001
ID: 39775750
Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question