For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > April 2004 > How do you set a startup winform in VS.NET?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How do you set a startup winform in VS.NET?
JG

2004-03-29, 11:32 pm

I have a project with two winforms in it. form1.cs and form2.cs. When I
press F5, form1.cs opens. How do I configure vs.net to start form2.cs
instead of form1.cs?

thanks,
joe


Thuy Trinh [MSFT]

2004-03-30, 4:44 am

Hi Joe,

You can add a Main() to Form2 and then use project properties to select
which form to startup. You can copy Main() from Form1 but modify it to
instantiate Form2(). Then bring up the project properties dialog by right
click on the project name in Solution Explorer and select Properties.
Navigate to Common Properties -> General -> Startup Object, there you'll
find the two options WindowsApplication1.Form1 & WindowsApplication1.Form2.

Thuy

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.


mohan@fjb.com.sg

2004-04-15, 11:31 pm

Hi Joe,

Write another main for your Form2 also( may be, you can copy & paste from Form1.cs and remember to change the Form Name to Form2 in the Main method).

Now you can change the Startup Object in the project Properties.

****************************************
******************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com