
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.
>.