Using a Class as startUp Object

EFileTahi-A

Contributor
Joined
Aug 8, 2004
Messages
623
Location
Portugal / Barreiro
Hello folks, It's been a while since I last posted here...

I would love to know how can I startup my .NET v2.0 project with a class instead of a form. I could do this in v1.1 but I don't know how to do this in 2.0.

Thank you :)
 
You should have a Program.cs file that looks something like:
C#:
static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new frmMain());
    }
}
Instead of calling Application.Run you can just create a new instance of your class.
 
Back
Top