Application.Run
Hi there
When you execute
Application.Run(new Form1())
the Application will display Form1
It doesn't seem to work if you execute something like
Application.Run(getForm())
public static Form getForm()
{
Form Form1 = new Form();
return Form1;
}
assume that Form1 has controls and a proper constructor and InitializeComponent() method.
The second invocation of Run does not seem to display the form. Is there something I am missing here?

Roei BarRank #1,271 · 1.4K reputationPosted Oct 3, 2009, 7:10 AM EDT
and this is why it doesnt work :-)
Master BillaRank #2,229 · 630 reputationPosted Oct 3, 2009, 6:58 PM EDT
No it will work, i seem you your code have some issues.
Here my code for you.
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(GetForm());
}
private static Form GetForm()
{
return new Form2();
}
}
}
Thank you