From: Athena on
Hi,

My VB6 (SP6) app produces an Overflow error and bombs. I use Win XP
(Sp2).

1) Program has Option Explicit. So every variable is typed.
2) Program works fine on one computer, but not on another!
3) Error is intermittent.
4) Sometimes it overflows even on VB timer function.

I am using a dll that was created from another program. In the calling
statement, there are 13 output arguments (x1,y1,z1,...) defined as Variant.
They are arrays with no priory knowledge of their size. And there are
several input arguments (in1,in2...) typed as double.

Dim b as variant
Dim x1 as variant
Dim y1 as variant
.......

call subroutine(13,
b,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,in1,in2,in3,in4,...)

These arrays used to plot a 3D graph:

with Graph3D

for i=1 to ubound(a1,1)
PlotXYZ x1(i,1),y1(i,1),z1(i,1),0
next
for i=1 to ubound(a1,1)
PlotXYZ x2(i,1),y2(i,1),z2(i,1),1
next
for i=1 to ubound(a1,1)
PlotXYZ x3(i,1),y3(i,1),z3(i,1),2
next
for i=1 to ubound(a1,1)
PlotXYZ x4(i,1),y4(i,1),z4(i,1),3
next
.autorange

end with

I believe the overflow is caused by somewhere in these for loops. If I
remove the last two or three loops it goes away! What the hell is going on?

Is there a way to detect/trap overflow? I run MS code advisor, it is
useless. Any help greatly be appreciated. Please help.

Cem







From: MikeD on

"Athena" <girit(a)comcast.net> wrote in message
news:uFoTCbq1FHA.3660(a)TK2MSFTNGP15.phx.gbl...
> Hi,
>
> My VB6 (SP6) app produces an Overflow error and bombs. I use Win XP
> (Sp2).
>
> 1) Program has Option Explicit. So every variable is typed.
> 2) Program works fine on one computer, but not on another!
> 3) Error is intermittent.
> 4) Sometimes it overflows even on VB timer function.
>
> I am using a dll that was created from another program. In the calling
> statement, there are 13 output arguments (x1,y1,z1,...) defined as
> Variant. They are arrays with no priory knowledge of their size. And there
> are several input arguments (in1,in2...) typed as double.
>
> Dim b as variant
> Dim x1 as variant
> Dim y1 as variant
> ......
>
> call subroutine(13,
> b,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,in1,in2,in3,in4,...)

You're not serious about passing ALL of those parameters are you? No wonder
you're having problems. After seeing that, I'm not even going to venture
into looking at the rest of your code.

Assuming I counted correctly....18 parameters (and apparently even
more)!?!?!?!? <MAJOR shudder> No offense intended (maybe you're not the
author of that procedure), but anyone that worked for me and wrote a
procedure like that would be gone within a week (and I just hope that I
wasn't the fool that hired him/her).

> Is there a way to detect/trap overflow? I run MS code advisor, it is
> useless. Any help greatly be appreciated. Please help.

It's a trappable error. It's error number is 6. You just need to write an
error handler for it. I don't see how that's going to help you, though.

My head's still spinning from passing 18+ parameters! <g>

--
Mike
Microsoft MVP Visual Basic



From: Athena on

Mike,

What I want is to plot a pointcloud data in 3D. Different parts of
the data is to have different colors. I should be able to rotate the
plot by using mouse. For this I have to write a piece of code either in
DirectX or OpenGL. Since I am not a professional programmer such as
yourself, my solution was to find a nice dll (NTGraph3d)and plot for x,y
and z sets (12 variables) using this dll. Do you know a VB code that
would plot >50000 data points in less than 1s and capable of rotating
the plot? I would be happy to use it right away.

Otherwise I am stuck with this "overflow" error.

Do you know how to find the origin of an overflow error? In my case
not only it is intermitent, but it pops up from different parts of the
program. This is what I want to find out from MVP's such as you.


Athena

*** Sent via Developersdex http://www.developersdex.com ***
From: Kevin Provance on
First, ditch the variants. Those are nothing but trouble. I would use
either a Long or Double, depending on how big the number is (look up both in
the documentation to determine this for yourself).

Next, I have to agree with Mike...passing all those arguments is just plain
bad. Instead, why not use properties for each variable. This way you can
set them as needed and get them in your subroutine, instead of passing them.
it would make your life incredibly easier.

This is about all I can suggest with the info you have provided. It would
help to know specifically which line you are experiencing the error, and
what the values of your variables are at the time of the error.

- Kev


"Athena" <Athena(a)devdex.com> wrote in message
news:ek8Ot6q1FHA.3204(a)TK2MSFTNGP14.phx.gbl...
>
> Mike,
>
> What I want is to plot a pointcloud data in 3D. Different parts of
> the data is to have different colors. I should be able to rotate the
> plot by using mouse. For this I have to write a piece of code either in
> DirectX or OpenGL. Since I am not a professional programmer such as
> yourself, my solution was to find a nice dll (NTGraph3d)and plot for x,y
> and z sets (12 variables) using this dll. Do you know a VB code that
> would plot >50000 data points in less than 1s and capable of rotating
> the plot? I would be happy to use it right away.
>
> Otherwise I am stuck with this "overflow" error.
>
> Do you know how to find the origin of an overflow error? In my case
> not only it is intermitent, but it pops up from different parts of the
> program. This is what I want to find out from MVP's such as you.
>
>
> Athena
>
> *** Sent via Developersdex http://www.developersdex.com ***


From: Someone on
See my post here about how to add error handling to all routines that
pinpoints the line number:

http://groups.google.com/group/microsoft.public.vb.general.discussion/msg/da28c493c61c6b60

Also, it looks like you typed your code instead of using Copy&Paste. Please
post code fragments and also the Dim statement. How a variable appears in a
Dim statement is very important.

In this example:

Dim Num1, Num2 As Double

Num1 is a Variant, Num2 is a Double. In VB6 and prior, use the following
syntax:

Dim Num1 As Double, Num2 As Double




"Athena" <girit(a)comcast.net> wrote in message
news:uFoTCbq1FHA.3660(a)TK2MSFTNGP15.phx.gbl...
> Hi,
>
> My VB6 (SP6) app produces an Overflow error and bombs. I use Win XP
> (Sp2).
>
> 1) Program has Option Explicit. So every variable is typed.
> 2) Program works fine on one computer, but not on another!
> 3) Error is intermittent.
> 4) Sometimes it overflows even on VB timer function.
>
> I am using a dll that was created from another program. In the calling
> statement, there are 13 output arguments (x1,y1,z1,...) defined as
> Variant. They are arrays with no priory knowledge of their size. And there
> are several input arguments (in1,in2...) typed as double.
>
> Dim b as variant
> Dim x1 as variant
> Dim y1 as variant
> ......
>
> call subroutine(13,
> b,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,in1,in2,in3,in4,...)
>
> These arrays used to plot a 3D graph:
>
> with Graph3D
>
> for i=1 to ubound(a1,1)
> PlotXYZ x1(i,1),y1(i,1),z1(i,1),0
> next
> for i=1 to ubound(a1,1)
> PlotXYZ x2(i,1),y2(i,1),z2(i,1),1
> next
> for i=1 to ubound(a1,1)
> PlotXYZ x3(i,1),y3(i,1),z3(i,1),2
> next
> for i=1 to ubound(a1,1)
> PlotXYZ x4(i,1),y4(i,1),z4(i,1),3
> next
> .autorange
>
> end with
>
> I believe the overflow is caused by somewhere in these for loops. If I
> remove the last two or three loops it goes away! What the hell is going
> on?
>
> Is there a way to detect/trap overflow? I run MS code advisor, it is
> useless. Any help greatly be appreciated. Please help.
>
> Cem
>
>
>
>
>
>
>