
Another VB4.0 Question...
Quote:
> Is there a bug in VB4.0 when trying to divide? The following is part of my
> code:
> Label51.Caption=a$
> Label53.Caption = b$
> Label55.Caption = (b$ / a$) / 0.01
> Basically, a$ is the total amount possible and b$ is the total achieved.
> Say that a$=55 and b$=31 : (b$/a$)=.5636363636364; take that and divide by
> 01 and it should equal 56.36...%
> When the code is executed though, the result that is placed into
> Label55.Caption is something like 1453256
> Any ideas about this? Please help.
When I first saw this, I boggled, mindwise. I am prompted to ask -
how are your a$ and b$ variables declared? Because the first two
lines treat them as strings (as the $ suffix suggests). Then the
third line appears to be attempting 'string division' which struck
me as rather an odd idea. I've heard of polymorphism and overloading,
but this is ridiculous.
However. Just to be on the safe side, I tried it out. And it does
indeed work. The thing is, I mean it *really* works. My caption
comes out as 56.3636363636364, so, being unable to reproduce your
symptoms, I have nothing further to offer. Peculiar, innit?
--
-------------------------------------------------------------------
BB 74 A4 EF 03 F8 44 C1 F3 75 FE C6 7E F9 6E 43 --- at home
-------------------------------------------------------------------