Help with overflow error 6 - any logical explanations ? 
Author Message
 Help with overflow error 6 - any logical explanations ?

I've been having an overflow error in a section of code. Based on a couple
of suggestions from the group, I've tried several methods to get rid of the
error. I even tried the following today but the overflow error is reported
now when I set a=0 in line 6. If I don't put in the
lines a=0, ... e=0 then an overflow is reported on the line e = c + (d - c)
/ 2.

The strange thing is that if I debug the code when the overflow occurs then
just hit Continue (>), the program runs fine with the correct results
reported.

Some other details:
-the code is within a function
-the function runs fine the first time then reports overflow errors each
subsequent time
-the other line that causes an overflow is   FrmInspect!BlobTool.Left = 20
where I try to position a control w.r.t. its container, this line is about
20 lines below the code shown. Again, hitting debug then continue makes the
program continue properly.

Q1>Why would an overflow be reported for setting a variable to 0? I'm not
certain of the internal overflow checking that goes on in VB. Would there
be a memory allocation problem?

Q2> Why would VB run the line of code fine once I hit debug then continue?
It seems that if the line of code did indeed cause an overflow then it
should not run properly when I hit continue.

Q3> Any other suggestions on what to try?

 Dim a As Single
  Dim b As Single
  Dim c As Single
  Dim d As Single
  Dim e As Single
  a = 0         >>>>>OVERFLOW
  b = 0
  c = 0
  d = 0
  e = 0

  a = KeyData(keynumber).Right
  b = KeyData(keynumber).Left
  c = KeyData(keynumber).Top
  d = KeyData(keynumber).Bottom

  e = c + (d - c) / 2  >>>OVERFLOW
--
Brent Dunn

--
Brent Dunn



Tue, 12 Oct 1999 03:00:00 GMT  
 Help with overflow error 6 - any logical explanations ?


Not sure that there IS any logical reason for something like this.
I've had similiar problems when I put a large amount of code all in
one module.  Try creating a new code module and move the offending
code into it.  I suspect that the error doesn;t really have anything
to do with your code, particularly since you can get the error to move
by changing the code a bit.

My suspicion is that you are short on some sort of resource (temp
variable space?,stack space?) and that as VB chunks along it asks for
the resource,doesn;t get it, acts as if it did, gets really confused
and gives you the error.

Some other things to check for: If you call any API's, make sure that
you have declared them with the correct number of arguments and
argument types.  All sorts of mysterious errors can arise when
arguments don't match up correctly.  

Brent- I got your e-mail and tried to respond directly.  Didn't work,
so I am posting here.

Quote:
>I've been having an overflow error in a section of code. Based on a couple
>of suggestions from the group, I've tried several methods to get rid of the
>error. I even tried the following today but the overflow error is reported
>now when I set a=0 in line 6. If I don't put in the
>lines a=0, ... e=0 then an overflow is reported on the line e = c + (d - c)
>/ 2.

>The strange thing is that if I debug the code when the overflow occurs then
>just hit Continue (>), the program runs fine with the correct results
>reported.

>Some other details:
>-the code is within a function
>-the function runs fine the first time then reports overflow errors each
>subsequent time
>-the other line that causes an overflow is   FrmInspect!BlobTool.Left = 20
>where I try to position a control w.r.t. its container, this line is about
>20 lines below the code shown. Again, hitting debug then continue makes the
>program continue properly.

>Q1>Why would an overflow be reported for setting a variable to 0? I'm not
>certain of the internal overflow checking that goes on in VB. Would there
>be a memory allocation problem?

>Q2> Why would VB run the line of code fine once I hit debug then continue?
>It seems that if the line of code did indeed cause an overflow then it
>should not run properly when I hit continue.

>Q3> Any other suggestions on what to try?

> Dim a As Single
>  Dim b As Single
>  Dim c As Single
>  Dim d As Single
>  Dim e As Single
>  a = 0             >>>>>OVERFLOW
>  b = 0
>  c = 0
>  d = 0
>  e = 0

>  a = KeyData(keynumber).Right
>  b = KeyData(keynumber).Left
>  c = KeyData(keynumber).Top
>  d = KeyData(keynumber).Bottom

>  e = c + (d - c) / 2  >>>OVERFLOW
>--
>Brent Dunn

>--
>Brent Dunn



Tue, 12 Oct 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Simple logical shift + logical and question and string to byte question

2. overflow error -- need help quickly !!!

3. OVERFLOW Error help!

4. Please help - overflow error using Access 97 database

5. Overflow Error - Please Help

6. ;Overflow (Error 6); !!!Can Anyone help me please

7. Urgent HELP asked for RIDICULOUS OVERFLOW error

8. Please help - overflow error using Access 97 database

9. Overflow Error - Please Help

10. Overflow error - PLEASE HELP

11. HELP OVERFLOW ERROR!!! :-(

12. Overflow error help!

 

 
Powered by phpBB® Forum Software