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

    Unhappy Exception handling VB6.0

    It is my understanding that if a function/subroutine encounters an exception then it looks for a handler in current function/subroutine if not it leaves the function and raises it in calling function hoping to find a handler there. Only after traveling up the call tree does it reach the runtime and that handles it as a fatal error and brings up a dialog box before shutting down the application.

    i had an identical piece of code that raised an exception. One was put in module and another in a class.

    I had a form button which either called the function in the module or called the method of an object i created from the class. This depended on whether a check box was selected. The lines of code trapped any exceptions that occured.

    The standard functions exception was trapped.

    The class methods exception was not. The debugger put me on the line in the class that raised the exception.

    I did this experiment cos i couldnt trap the exceptions in this tcp/ip class i am using. Surely there must be way of trapping the exceptions on it. Is some setting in my IDE set wrong.

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Exception handling VB6.0

    The IDE behaves differently than an EXE will.

    Most likely you have Break on Errors in Class set on.

    I normally use break on unhandled errors instead.

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Exception handling VB6.0

    It is not the method. It is the settings in the IDE.

    On the menu go to Tools/Options Then go to the general tab and look at the section for error trapping. Most likely you will see that the radio button next to Break in Class Module is selected. Change this to Break on Unhandled Errors

Tags for this Thread

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