using System;
using System.Threading;
using System.Reflection;
using System.Windows.Forms;
public class HelloWorldForm : Form
{
public HelloWorldForm()
{
Text = "Hello, WindowsForms!";
}
}
public class ApplicationEventHandlerClass
{
public void OnThreadException(object sender, ThreadExceptionEventArgs e)
{
Console.WriteLine("an exception thrown from an application thread was caught!");
}
}
public class MainClass
{
public static void Main()
{
HelloWorldForm FormObject = new HelloWorldForm();
ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.ThreadException += new ThreadExceptionEventHandler(AppEvents.OnThreadException);
Application.Run(FormObject);
}
}
|