0

Can abyone tell me what type of variable is a standard Form1?

It's just a curiosity and not a real part of a project.

here is the standard code visual studio starts with in my version 2010 when creating a new forms application with a couple of lines added/amended..

namespace AdoptChrome
{
    static class Program
    {

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var instance = new Form1(); //<============== This here
            Application.Run(instance);
            instance.cleanup();// this cleans up some external library mess.

        }

    }
}

I expect that Form1 is a class, but I cannot use that as a type because of some error or other.
So I simply use "var", however that is what my question is.

What actual real type could I use instead of var?

My app is working as expected up to now, but I cannot find the correct term to a get a good answer from a web search.

Thanks for reading.

Edited by Suzie999

2
Contributors
2
Replies
16
Views
3 Years
Discussion Span
Last Post by Suzie999
2

What actual real type could I use instead of var?

The type is Form1, since that's the name of the class, and it derives from System.Windows.Forms.Form:

Form1 instance = new Form1();
0

I'd have sworn I tried that, must have tried Form instead.

Thanks deceptikon.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.