I am trying to start a Windows Application with a non form class Class1. The object of Class1 should insatiate the form Form1 like this:
Code:namespace WindowsApplication2 { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Class1 someobject=new Class1(); Application.Run(); } } }
Code:namespace WindowsApplication2 { class Class1 { private Form1 myform; public Class1() { myform=new Form1(); } } }The code is really simple and I can not understand why this is not workingCode:namespace WindowsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } } }
could anyone please give me an advice what is wrong and how to do?




Reply With Quote