CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Run time Error

  1. #1
    Join Date
    Jan 2000
    Posts
    14

    Run time Error

    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.


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Run time Error

    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
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  3. #3
    Join Date
    Jan 2000
    Posts
    14

    Re: Run time Error

    Thanks, John, for the help. And the bug is fixed now! I gave you a rate for 10!

    NiteStone


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured