Results 1 to 2 of 2

Thread: handling unhandled exceptions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Location
    Botswana
    Posts
    107

    handling unhandled exceptions

    i found this in the help file:
    To log an unhandled exception
    Have a project selected in Solution Explorer. On the Project menu, choose Properties.

    Click the Application tab.
    Click the View Application Events button to open the Code Editor.
    This opens the ApplicationEvents.vb file.
    Have the ApplicationEvents.vb file open in the Code Editor. On the General menu, choose MyApplication Events.
    On the Declarations menu, choose UnhandledException.
    The application raises the UnhandledException event before the main application runs.
    Add the My.Application.Log.WriteException method to the UnhandledException event handler.

    and then i add this:

    Code:
    My.Application.Log.WriteException(e.Exception, _
    TraceEventType.Critical, _
    "Application shut down at " & _
    My.Computer.Clock.GmtTime.ToString)

    heres a stupid question: wheres the log kept at? how do i read it?

    also, i saw that theres a setting in the unhandled exception event that can be set so that the app isnt terminated when the event is raised. how do i change this?
    __________________
    I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: handling unhandled exceptions

    Quote Originally Posted by dreamdelerium
    heres a stupid question: wheres the log kept at? how do i read it?
    If you read the documentation for the My.Application.Log.WriteException method it provides links to topics that answer those questions.
    also, i saw that theres a setting in the unhandled exception event that can be set so that the app isnt terminated when the event is raised. how do i change this?
    It's a property of the UnhandledExceptionEventArgs object that is passed to the event handler via the 'e' parameter. How do you usually set a property? Same applies here.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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