grignard
October 19th, 2008, 08:34 AM
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:
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();
}
}
}
namespace WindowsApplication2
{
class Class1
{
private Form1 myform;
public Class1()
{
myform=new Form1();
}
}
}
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
The code is really simple and I can not understand why this is not working
could anyone please give me an advice what is wrong and how to do?
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();
}
}
}
namespace WindowsApplication2
{
class Class1
{
private Form1 myform;
public Class1()
{
myform=new Form1();
}
}
}
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
The code is really simple and I can not understand why this is not working
could anyone please give me an advice what is wrong and how to do?