Application.Run without passing first form as argument

E

Erik Jensen

I am interested in calling Application.Run() without
passing a first form as the argument to the Run method.
Reason being is that i would like to instantiate some
helper or foundation classes before showing any vestiges
of a form on the screen.

This is how i am trying:
Form1 frm = new Form1();
//form one is empty with a textbox for fun in it
frm.Visible = false;
frm.WindowState = FormWindowState.Minimized;
Application.Run();
HelperClass1 help = new HelperClass1();
help.DoDuties();
frm.Show();

But the form is not showing.

Does anyone know of how to start an application and maybe
not call a form till later.. or hide the form and call
helper classes after. I am interested in not having the
Main method within my first Form's class.

I cant seem to find much in teh way of sample windows
forms applications around in the open source community.


Any Ideas?

Thanks
 
J

Jon Skeet [C# MVP]

Erik Jensen said:
I am interested in calling Application.Run() without
passing a first form as the argument to the Run method.
Reason being is that i would like to instantiate some
helper or foundation classes before showing any vestiges
of a form on the screen.

This is how i am trying:
Form1 frm = new Form1();
//form one is empty with a textbox for fun in it
frm.Visible = false;
frm.WindowState = FormWindowState.Minimized;
Application.Run();
HelperClass1 help = new HelperClass1();
help.DoDuties();
frm.Show();

But the form is not showing.

Does anyone know of how to start an application and maybe
not call a form till later.. or hide the form and call
helper classes after. I am interested in not having the
Main method within my first Form's class.

I cant seem to find much in teh way of sample windows
forms applications around in the open source community.

Why don't you just make Application.Run your last statement instead of
having it half way down your code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top