Home All Groups Group Topic Archive Search About
Author
27 Jan 2007 4:20 PM
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,

Author
27 Jan 2007 5:05 PM
Teemu
"Gabriel" <nospam@nospam.com> kirjoitti
viestissä:OOkJJ8iQHHA.3***@TK2MSFTNGP05.phx.gbl...
> 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
Are all your drivers up to date? click for free checkup

Author
28 Jan 2007 7:59 AM
Gabriel
> 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,
Author
28 Jan 2007 9:13 PM
RobinS
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.
---------------------------------
Show quoteHide quote
"Gabriel" <nospam@nospam.com> wrote in message
news:%23FdMuIrQHHA.3412@TK2MSFTNGP05.phx.gbl...
>
>> 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,
>
Author
28 Jan 2007 1:38 PM
Otis Mukinfus
On Sat, 27 Jan 2007 17:20:20 +0100, "Gabriel" <nospam@nospam.com> wrote:

>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
Author
29 Jan 2007 9:33 AM
Carlos Manuel Perez Fernandez
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 Perez

Bookmark and Share