Solved

vb6 displaying wrong calculation

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

760 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

21 Experts available now in Live!

Get 1:1 Help Now