Starting a windows application from outside the form

  • Thread starter Thread starter Jesse
  • Start date Start date
J

Jesse

Hi,

Can anyone suggest how to go about running a windows application from
outside the starting form. ie. making a call to the initial form and then
showing it. I have tried this using a separate class file with static void
Main()
{
MainForm mf = new MainForm();
mf.Show();
}

But as soon as the form shows the application ends. As you can tell i am an
absolute novice so any help would be appreciated.

Thanks,
Jesse
 
You need to keep pumping the Window messages to the window. You can do that
by

Main()
{
MainForm mf = new MainForm();
Application.Run(mf);
}

-vJ
 
Hi, thanks for the reply.

When i do that i get an error:

"The type or namespace name 'Application' could not be found ..."

what does this mean?
 
Try System.Windows.Forms.Application or add "using System.Windows.Forms" to
the top of the file.

-vJ
 
Back
Top