Solved

vb6 displaying wrong calculation

Posted on 2014-01-12
4
190 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 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 250 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 45

Accepted Solution

by:
aikimark earned 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

919 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now