User Tools

Site Tools


Exception handler for a WinForms application

The following code can be used to display an exception in a Windows Forms application. Please don't forget to log the exception also somewhere.

class wfExceptionEventHandler

constructor( oSender as object, oArgs as ThreadExceptionEventArgs )
local oException as Exception
local nResult as DialogResult
local cMessage as string

oException := oArgs:Exception
cMessage := "An error has been occurred:" + e"\n\n" + oException:Message + e"\n\n" + ;
               oException:StackTrace + e"\n\n" + "Continue execution?"								
nResult := MessageBox.Show( cMessage, "Runtime error", MessageBoxButtons.YesNo)									
if nResult == DialogResult.No


end class
exception_handler_winforms.txt · Last modified: 2018/03/25 20:07 by wolfgangriedmann