Page 1 of 1

VB6 Error - Floating Point Division by Zero

Posted: Fri Feb 13, 2004 4:42 pm
by 6921157
Hi, Friday, 13/2/2004


I am using TChart Pro ActiveX V5.02 - with VB6 against a SQL2000 database.



TChart maps various series from data in our DB.
When the data includes Null values there is an if clause that adds the point
to the series - as shown in code below.

If ValidDouble(rsTemp!ResultMeanQA) Then

objTChart.Series(lngSeries).AddXY dblXValue, rsTemp! ResultMeanQA, "", objTChart.Series(lngSeries).Color

Else

objTChart.Series(lngSeries).AddNullXY dblXValue, 0,"",objTChart.Series(lngSeries).Color

End If

I found that if the first entries in the database were NULL values then I
obtained the endless VB6 error message box saying, "Floating point division by zero". I can not always stop the program, but have to go to Task Manager to shut down my program as it has got into a loop.


I changed the values in the DB table in question to non-NULL values, but the problem still recurs with those tables. I use other tables and the graphs work fine. I get the VB6 error message for all tables where NULL values are the first data items to be added to the series and the same error message for just a few of the other tables.



I tried many things, one of which was to use just the normal .AddXY
statement, but that made no difference. I have even tried adding a zero value to the series first before the NULL values from the database are introduced.

Also, if the NULL values occur in the middle of the data set from the table , then I don't get this problem.

I changed the values in the DB table in question to non-NULL values, but the problem still recurs with those tables - very strange.

I would be grateful for any suggestions.

Kind regards,

Polly

Posted: Fri Feb 27, 2004 3:11 pm
by 6921157
Found it.

My code was dynamically setting the Tchart.Axis.Bottom.Increment
property and using the int() function, which meant that at times the increment was set to zero. When I went to add values to the Series with increment set to zero I would get the VB6 Division By Zero error messages.

Polly