|
-
Nov 7th, 2000, 05:04 AM
#1
Thread Starter
Member
The following code is used to compare two numbers:
Dim sngValues(2) As Single
Dim intAmount As Integer
Dim sngTestValue As Single
sngValues(0) = 63.7
If round(100 * sngValues(0)) = 100 * sngValues(0) then
msgbox "YES"
else
end
endif
Yet the msgbox for this particular number never occurs??????
Any ideas???
-
Nov 7th, 2000, 05:21 AM
#2
Frenzied Member
I tried your code and the message box appears for me.
-
Nov 7th, 2000, 05:34 AM
#3
Fanatic Member
Singles
Very odd!
Have you tried re-booting...
Cheers,
Paul.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 7th, 2000, 06:00 AM
#4
Thread Starter
Member
DOH!
-
Nov 7th, 2000, 06:06 AM
#5
Fanatic Member
What?!???
what number, where, how, why - you've been fibbing again, haven't you....
Paul.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 7th, 2000, 06:11 AM
#6
Thread Starter
Member
Me-I never lie!
sngValues(0) = 1.359293
If round(100 * sngValues(0)) = 100 * sngValues(0) then
msgbox "YES"
else
end
endif
Sorry this is the correct bit of code, as to how and why not sure a colleague is using it and asked me to place it on this wonderful site for real VB programmers to ponder!
-
Nov 7th, 2000, 07:00 AM
#7
Fanatic Member
Well it wouldn't work, would it?
Round 135.9293 is 136 (i.e. <> 135.9293
DOH...
Use this to see what is going on...
MsgBox Round(100 * sngValues(0)) & ", " & 100 * sngValues(0)
Cheers,
Paul.
Not nearly so tired now...
Haven't been around much so be gentle...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|