Hi,
I am a bit new to C# - though I have managed to get some sample programs/projects to compile.
I would like to know how to get two or more forms to work. More specifically, I would like to know how to start up a single form from a function or something like that. (I tried to search for the terms “Multiple Forms�or on “Exchanging Data between multiple forms�and could not get any results.)
I first started out with a simple project, that works created in Visual Studio 2005 that also contained a form. Up to this part, the form displayed fine. Visual Studio had a class Program which had a main() function that would crank this entire thing. Now I declared a Main class (static class Main) �then I copied the main() method from the Program class to the Main class.
Code Block
[STAThread] static void main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainGUI());
//Main mn = new Main();
}
This does not work. It tells me that I cannot declare “Application�in this context. I did not understand why. I guess that the reason for my mistakes might be that I did not understand what exactly is [STAThread] �it was set automatically inside the “Program Class �and I manually moved it. I thought this was just a way to tell the code where to start execution so I did not think it would matter.
I would be glad if anyone had some ideas. Thanks to all you guys.
Regards,
O.O.