I am trying to write an unhandled exception event handler as in this question Catching application crash events
But the code as given won't compile, giving the message
error BC30590: Event 'UnhandledException' cannot be found.
How to fix? Do I need to import something (I'm new to VB) - if so then what?
Partial Friend Class MyApplication
Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
MsgBox(e.Exception.Message + vbNewLine + e.ToString())
End Sub
End Class