Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set which of the forms appear first

Tags:

c#

winforms

I'm a beginner c# programmer, and i'm getting familiar with the Windows Forms App. I have 2 forms and i'm trying to understand how to set one of them to be the first one that appears when i'm running the application.

Is there a way to set this, or I have to create the forms by the order they appears?

like image 478
Tamar Cohen Avatar asked Nov 25 '12 16:11

Tamar Cohen


People also ask

How do I choose which form opens first in Visual Basic?

In Solution Explorer , right-click the project and choose Properties . The Project property page opens with the General properties displayed. Choose the form you want as the startup form from the Startup Object drop-down list. Save this answer.

How do you make a form always on top?

You can bring a Form on top of application by simply setting the Form. topmost form property to true will force the form to the top layer of the screen, while leaving the user able to enter data in the forms below. Topmost forms are always displayed at the highest point in the z-order of the windows on the desktop.

Which event occurs before a form is displayed for the first time?

Load: This event occurs before a form is displayed for the first time. VisibleChanged: This event occurs when the Visible property value changes.


2 Answers

In Program.cs, you will see the following line of code

Application.Run(new Form1());

This line shows Form1.
You can change it to do whatever you want.

like image 149
SLaks Avatar answered Oct 10 '22 00:10

SLaks


In Program.cs, you will see the following line of code

Application.Run(new Form1()); This line shows Form1. You can change it to do whatever you want.

like image 45
fakhir ali Avatar answered Oct 09 '22 22:10

fakhir ali