Handling Application Events : Application Event : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Application Event »

 

Handling Application Events









    

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);
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Application Event