You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 C# Handling Application Events on Tue Aug 24, 2010 3:43 am

Top


Contributor
Loading
Simple box, you and edit you're self.
Code:
using System;
using System.Threading;
using System.Reflection;
using System.Windows.Forms;
 

public class HelloWorldForm : Form
{
    public HelloWorldForm()
    {
        Text = "Sup?!";
    }
}
 
public class ApplicationEventHandlerClass
{
 
    public void OnThreadExit(object sender, EventArgs e)
    {
        Console.WriteLine("The application's main thread is shutting down.");
    }
}
 
public class MainClass
{
    public static void Main()
    {
        HelloWorldForm FormObject = new HelloWorldForm();
        ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
 
        Application.ThreadExit += new EventHandler(AppEvents.OnThreadExit);
        Application.Run(FormObject);
    }
}

View previous topic View next topic Back to top  Message [Page 1 of 1]

Related topics

Permissions in this forum:
You cannot reply to topics in this forum