{filelink=17883}
using System;
using System.Windows.Forms;
public class EvenementOnThreadException: Form
{
public HelloWorldForm()
{
Text = "Exemple des événements 'Form'!";
}
}
public class ApplicationEventHandlerClass
{
public void OnThreadException(object sender, ThreadExceptionEventArgs e)
{
Console.WriteLine("L'exception relative à cette application est gérée");
}
}
public class MainClass
{
public static void Main()
{
EvenementOnThreadException FormObject = new HelloWorldForm();
ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.ThreadException += new ThreadExceptionEventHandler(AppEvents.OnThreadException);
Application.Run(FormObject);
}
}