|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Starting from ....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" <nospam@nospam.com> kirjoitti viestissä:OOkJJ8iQHHA.3***@TK2MSFTNGP05.phx.gbl...> Hello, This is much easier in VB but also possible in C#.> > 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. 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#. Thanks Teemu.> There is a file called Program.Cs and there is line: > Application.Run(new Form1()); > Change that Form1 and it should work. I know that but I was searching a possibility to change that via the VS2005 Gui. Regards, 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, > On Sat, 27 Jan 2007 17:20:20 +0100, "Gabriel" <nospam@nospam.com> wrote: static class Program>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, > { /// <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 Hello Gabriel,
> Hello, On the Solution Explorer Window, you can right-click over the project and > > 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, > 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
Other interesting topics
Non-proportional (non Rectangular) resizing
Asynchronous Programming Model - how to implement? ComboBox updating data source via look-up table DirectoryInfo - How To Get Name in Proper Case? How to Create WinForms client and ClassLib server as one assembly? Disable a text box when it's not adding new row? Possible help for Newbie Studio 2005 and the ".Designer" file...?!? Code practice in properties. VS 2003, false data concurrency error Dataset and scalability issue |
|||||||||||||||||||||||