title: VB.net Unhandled Exceptions Dialog / Log UnhandledException cannot be found
body: <p>In the course of tracking down another error for a project I came across a method to provide some feedback for unhandled exceptions.  I've followed the instructions from the original post, but it seems things might be a little different as of Visual Studio 2010.  What I'm tyring to do is either pop up a message box or write a log file for errors that occur in an application that where completely unexpected an unhandled.  I don't get them very often, but when I do my applications fail siliently.  Here's what I've got in the ApplicationEvents.vb file:</p>
  
  <pre><code>Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
  
      MessageBox.Show(e.Exception.ToString)
      e.ExitApplication = False
  
  End Sub
  </code></pre>
  
  <p>The error I'm gettin now is <code>Statement is not valid in a namespace.</code> which completely makes sense.  It seems I need to place this in a class, so I tried placing the code in a public class named ErrorHandler and now I'm told <code>UnhandledException</code> cannot be found.  Is this a different property of Me now?  Or do I need to string up the UnhandledException myself somehow?  Or is there an entierly different and better way to approach this?</p>