Connecting Tech Pros Worldwide Forums | Help | Site Map

VBScript problem

Newbie
 
Join Date: Aug 2007
Posts: 2
#1: Aug 13 '07
The following code is used similarly in a more complex program. The user will input the number of clicks, the factor and the total. The program calculates the clicks times the factor and compares the result to the input total. Various numbers produce an unequal comparison despite the fact that both numbers are the same. What am I doing wrong?

Option Explicit

dim intClicks
dim dbltotlbs
dim dblfactor
dim dblpounds


dblfactor = 0.33
intclicks = 3948
dblpounds = 1302.84

dbltotlbs = intclicks * dblfactor
if dbltotlbs <> dblpounds then
MsgBox dbltotlbs
MsgBox dblpounds
else
MsgBox "Equal"
end if





MsgBox "end"

................

Using 3949 and 1303.17 checks out ok. There are other combinations that work and still others that don't.

Thanks in advance for any light you can shed on the problem.

JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Aug 13 '07

re: VBScript problem


Please check the blue menu bar near the top of this page. The 'Forums' section
is the right place to ask technical questions. Try again there and I'm sure you
have better luck overthere.

kind regards,

Jos
kestrel's Avatar
Moderator
 
Join Date: Jul 2006
Location: California!!!
Posts: 898
#3: Aug 14 '07

re: VBScript problem


I dont know if VB and VBscript are the same, or even close (just like Java and javascript are worlds apart). But im going to move this to the VB forum anyways
Reply


Similar Visual Basic 4 / 5 / 6 bytes