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,
Teemu - 27 Jan 2007 17:05 GMT
"Gabriel" <nospam@nospam.com> kirjoitti
viestissä:OOkJJ8iQHHA.3500@TK2MSFTNGP05.phx.gbl...
> Hello,
>
[quoted text clipped - 3 lines]
> 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
Gabriel - 28 Jan 2007 07:59 GMT
> 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,
RobinS - 28 Jan 2007 21:13 GMT
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.
---------------------------------
>> This is much easier in VB but also possible in C#.
>> There is a file called Program.Cs and there is line:
[quoted text clipped - 7 lines]
>
> Regards,
Otis Mukinfus - 28 Jan 2007 13:38 GMT
>Hello,
>
[quoted text clipped - 5 lines]
>
>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
Carlos Manuel Perez Fernandez - 29 Jan 2007 09:33 GMT
Hello Gabriel,
> Hello,
>
[quoted text clipped - 5 lines]
>
> 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