Starting from ....

  • Thread starter Thread starter Gabriel
  • Start date Start date
G

Gabriel

Hello,

A very small question, how set the starting form in a Winforms projects (VS
2005, C#2.0).

I check in the project properties but I didn't see a way to select a form to
start.

Regards,
 
Gabriel said:
Hello,

A very small question, how set the starting form in a Winforms projects
(VS 2005, C#2.0).

I check in the project properties but I didn't see a way to select a form
to start.

This is much easier in VB but also possible in C#.

There is a file called Program.Cs and there is line:

Application.Run(new Form1());

Change that Form1 and it should work.

-Teemu
 
This is much easier in VB but also possible in C#.
There is a file called Program.Cs and there is line:
Application.Run(new Form1());
Change that Form1 and it should work.


Thanks Teemu.

I know that but I was searching a possibility to change that via the VS2005
Gui.

Regards,
 
Hello,

A very small question, how set the starting form in a Winforms projects (VS
2005, C#2.0).

I check in the project properties but I didn't see a way to select a form to
start.

Regards,

static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ****YOUR_STARTUP_FORM_NAME()****);
}
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
I don't think you can. In VB.net, you can set the
startup object as a form rather than Main(), but
in C#, I think it has to be Sub Main(), and the only
choice you have is which class's Sub Main() to use
(if you have Sub Main() in more than one class).

Robin S.
---------------------------------
 
Hello Gabriel,
Hello,

A very small question, how set the starting form in a Winforms
projects (VS 2005, C#2.0).

I check in the project properties but I didn't see a way to select a
form to start.

Regards,

On the Solution Explorer Window, you can right-click over the project and
choose Properties. Inside the Properties Window, in the Application tab,
you can choose the Startup class.

Normally in C# 2.0 the startup class is Program.cs, and on its Main() method
it calls the first form of the application. You can change the starting form
there.

Regards,
Carlos M Pere
 
Back
Top