-2

My app is like this

static void Main()
{
    MessageBox.Show("aaa");
    Application.EnableVisualStyles();
    MessageBox.Show("b");
    Application.SetCompatibleTextRenderingDefault(false);
    MessageBox.Show("c");
    Application.Run(new login());
    MessageBox.Show("d"); 
}

Only MessageBox is visible on screen, in taskbar appears the application is running but the window form login() never shows.

When the last MessageBox is closed, the app closes immediately.

I'm a new developer in C# with .NET

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

There is no issue with the code you have shared. If you are able to see the last message box that means, the login form opened & closed. If you share the code written in login form, then someone can tell why the form is closing by its own.

Hope you are not closing the form using such code.

private void login_Load(object sender, EventArgs e)
    {
        this.Close();
    }
S P
  • 1
  • 1