Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8345965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:51:22+00:00 2026-06-09T06:51:22+00:00

I have 3 forms – the main form is Form1 the others are a

  • 0

I have 3 forms – the main form is Form1 the others are a splash form and then a login screen.
Splash screen displays first and populates servers. Then, the frmAppLogin is shown, user enters a hardcoded password and result returns to form1.

public Form1()
    {
        _assembly = Assembly.GetExecutingAssembly();

        Stream icon = _assembly.GetManifestResourceStream.....

        this.Icon = new Icon(icon);

        Thread t = new Thread(new ThreadStart(SplashScreen));
        t.Start();
        InitializeComponent();
        PopulateServers();
        //Thread.Sleep(800);
        Form frmLogin1 = new frmAppLogin();
        t.Abort();

        frmLogin1.ShowDialog();


        DialogResult res = new DialogResult();
        res = frmLogin1.DialogResult;
        if (res == DialogResult.OK)
        {
            _LoggedIn = true;
        }

        else
        {
            _LoggedIn = false;
        }
 }

This is the code for form1_load:

private void Form1_Load(object sender, EventArgs e)
    {
        if (_LoggedIn)
        {
            try
            {
                blah blah........
            }
            catch
            {
                MessageBox.Show("Error accessing resources!");
            }
        }
        else
        {
            this.Close();
        }
    }

And the code for the Login form:

public frmAppLogin()
    {
        InitializeComponent();
        this.WindowState = FormWindowState.Normal;
    }


    private void btnAppLogin_Click(object sender, EventArgs e)
    {
        if (txtAppPass.Text.ToString() == requiredPass)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        else
        {
            txtAppPass.Clear();
            txtAppPass.Focus();
            MessageBox.Show("Incorrect Password");
        }
    }

Problem is when the splash screen disappears, the log in form pops up for a split second but immediately minimizes to the taskbar.

Startposition is set to CenterScreen and WindowState Normal via GUI.

Also this only happens when I run the application.exe in (or copy it from) the debug folder, I.E. it does not happen when I debug in Visual Studio 2010.

Edit: Just to add this in, I have also tried:

   private void frmAppLogin_Load(object sender, EventArgs e)
    {
        this.WindowState = FormWindowState.Normal;
    }

Which didn’t help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:51:26+00:00Added an answer on June 9, 2026 at 6:51 am

    I’m pretty sure you are diagnosing this wrong. The dialog doesn’t minimize, it disappears behind the window of another application. Usually Visual Studio, everybody maximizes it so it is really good at covering other windows. Minimize other windows to find the dialog back.

    What goes wrong here is that for a split second, your app doesn’t have any windows that Windows can give the focus to. Twice actually, between the splash screen and the login form. Again between the login form and your main form. The Windows window manager is forced to find another window to focus and, since you don’t have any candidates, it will pick the window of another app.

    The window manager has allowance to give an app time to create its first window, that inevitably takes time. Your splash screen no doubt messes up that logic. The code is not easy to repair as posted, the standard tricks to invoke code after calling ShowDialog() won’t work because your app is not yet pumping a message loop. Which in itself is a problem. Start tackling this problem at least by fixing the splash screen, .NET already has solid support for them built-in. Answer is here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 forms ( main and login ). I open the login form
I have multiple forms like so: <form method=post action=change.php id=form1> <input name=product_id type=hidden value=abc
I have two forms, first form contains the textbox and second form contains a
I have 2 forms. The first one is an async post that populates the
I'm using Windows Forms in C#. I have a main form with a couple
I have 2 forms on my page. One is FOSUserBundle's login form and the
I have two forms in my project, form1 and form2. I have added a
I have two forms and form1 needs to get data from form2 , i
I have 2 forms : Form1 , Form2 . Form1 has checkedlistbox : checkedlistbox1
I have 3 forms on my project. form1 is MDI controller form2 and form3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.