Like C#.NET Console application, windows form applications have function main() as starting point of code execution.
If you carefully note the solution explorer of your C#.NET windows form application, you will see Program.cs file.
In Program.cs file, you will see following default code -
Here, from the code snippet above, Main() method has a code statement as
Application.Run(new form1());
This part will determine the starting point of the application, So setting different windows form object will start application execution from this newly set windows form rather than form1.
So following change will make the application execution start from windows form-frmLogin
Application.Run(new frmLogin());
Save changes, Build and Run the application to view the result.
If you carefully note the solution explorer of your C#.NET windows form application, you will see Program.cs file.
In Program.cs file, you will see following default code -
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new form1());
}
}Here, from the code snippet above, Main() method has a code statement as
Application.Run(new form1());
This part will determine the starting point of the application, So setting different windows form object will start application execution from this newly set windows form rather than form1.
So following change will make the application execution start from windows form-frmLogin
Application.Run(new frmLogin());
Save changes, Build and Run the application to view the result.
No comments:
Post a Comment