NiteStone
January 21st, 2000, 06:04 AM
I wrote a program and it works fine when i ran it with VB. But after i made a setup file with Application Setup wizard and installed it into my computer for testing, i got a run time error: Division by zero. How do i debug this run time error? Please help. Thanks in advance. :)
Johnny101
January 21st, 2000, 11:12 AM
1)In your options for VB choose to Break on Unhandled Errors.
2)Look through your code and set breakpoints on all division operations that use variables as the divisor.
3)At runtime, check the values of these variables to make sure they are you are expecting them to be.
4)Turn Require Variable Declaration on. - I have several people hunt for days for a bug, when all they really did was type the name of variable wrong. If this is off, VB will just create another variable for you, but it doesn't know what should be in that variable.
5)Add error handling to those procedures that have the division operations.
ex:
Function Divide(iDivisor as integer, iDividend as integer) as double
On error goto handler
Divide = iDividend / iDivisor
Exit Function
Handler:
Msgbox "An Error occurred: " & err.number & " : " & err.description.
End Function
Hope this helps,
John
John Pirkey
MCSD
www.ShallowWaterSystems.com
NiteStone
January 22nd, 2000, 12:50 AM
Thanks, John, for the help. And the bug is fixed now! I gave you a rate for 10!
NiteStone