Greater than conditional testing problems 
Author Message
 Greater than conditional testing problems

Am I missing something here?  When I use standard VB code to test
variables that are declared as doubles or singles, the > and < operators
are checking STRING length rather than numeric data.  I hack around this
by multiplying the variable by 1, which seems to force it to evaluate
the condition as numbers instead of strings.  I know that all variables
in eVB are variants, but is everybody else writing:

If v1 * 1 < v2 * 1 then ...

I had a fit with adding values I had collected in textboxes.  If
TxtWindow1 has 3.5, and TxtWindow2 has 6.6 and you add (that is,
Result=TxtWindow1 + TxtWindow2), the result is 3.56.6 instead of 10.1.
That's string concatenation, not addition.  I fixed this by multiplying
by 1 before the addition function. I haven't tried to add numbers with
the & symbol... think I'll try that tomorrow.

Also, does everybody's watch window go cranky until you edit the watched
variable?  I add a watch and the others complain "cannot compile
module".  When I edit the watch, and do nothing, it shows a value.
Also, using arrays, the watch window gets real screwed up.

Is eVB 3.0 the buggiest thing you have ever worked with?  Do I hate
variants yet?
Okay, what did I expect for $8.95.

Jim Murphy
Raleigh NC

Oh, thanks for the note about the left(mystring,2) bug.  Drove me
crazy.  I spend more time working around the junk than I do
programming.  Especially when 2.123 is larger than 9.01.  Sheesh.



Sun, 24 Oct 2004 06:17:00 GMT  
 Greater than conditional testing problems
If the following explanation does not help then show more
of your code in an additional post.
Text boxes store text strings.  You should convert them to
numbers for numeric calculations.  Multiplying by a number
as in your example will force a conversion.  You can
accomplish the same thing with CLng, CInt, CSng, etc.  In
your example try
Result = CSng(TxtWindow1.text) + CSng(TxtWindow2.text)
The watch window is buggy and unreliable at its best.  I
use the immediate window to check my values.  It is slower
but works most of the time.

Quote:
>-----Original Message-----
>Am I missing something here?  When I use standard VB code
to test
>variables that are declared as doubles or singles, the >
and < operators
>are checking STRING length rather than numeric data.  I
hack around this
>by multiplying the variable by 1, which seems to force it
to evaluate
>the condition as numbers instead of strings.  I know that
all variables
>in eVB are variants, but is everybody else writing:

>If v1 * 1 < v2 * 1 then ...

>I had a fit with adding values I had collected in
textboxes.  If
>TxtWindow1 has 3.5, and TxtWindow2 has 6.6 and you add
(that is,
>Result=TxtWindow1 + TxtWindow2), the result is 3.56.6
instead of 10.1.
>That's string concatenation, not addition.  I fixed this
by multiplying
>by 1 before the addition function. I haven't tried to add
numbers with
>the & symbol... think I'll try that tomorrow.

>Also, does everybody's watch window go cranky until you
edit the watched
>variable?  I add a watch and the others complain "cannot
compile
>module".  When I edit the watch, and do nothing, it shows
a value.
>Also, using arrays, the watch window gets real screwed up.

>Is eVB 3.0 the buggiest thing you have ever worked with?  
Do I hate
>variants yet?
>Okay, what did I expect for $8.95.

>Jim Murphy
>Raleigh NC

>Oh, thanks for the note about the left(mystring,2) bug.  
Drove me
>crazy.  I spend more time working around the junk than I
do
>programming.  Especially when 2.123 is larger than 9.01.  
Sheesh.
>.



Sun, 24 Oct 2004 08:05:27 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST

2. TEST TEST TEST TEST

3. alt.test,comp.test,misc.test,news.test

4. Delphi = GREAT And VB5 = Not so great

5. GREAT QUESTION NEED GREAT HELP

6. Problem with Conditional Formating

7. Conditional Formating Problem.

8. Problems with conditional suppression

9. TEST TEST TEST

10. TEST TEST TEST

11. Testing,testing,testing

12. test test test

 

 
Powered by phpBB® Forum Software