Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

Starting from ....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gabriel - 27 Jan 2007 16:20 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.