Note that there are some explanatory texts on larger screens.

plurals
  1. POForm starts minimized
    text
    copied!<p>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.</p> <pre class="lang-cs prettyprint-override"><code>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; } } </code></pre> <p>This is the code for form1_load:</p> <pre class="lang-cs prettyprint-override"><code>private void Form1_Load(object sender, EventArgs e) { if (_LoggedIn) { try { blah blah........ } catch { MessageBox.Show("Error accessing resources!"); } } else { this.Close(); } } </code></pre> <p>And the code for the Login form:</p> <pre class="lang-cs prettyprint-override"><code>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"); } } </code></pre> <p>Problem is when the splash screen disappears, the log in form pops up for a split second but immediately minimizes to the taskbar. </p> <p>Startposition is set to CenterScreen and WindowState Normal via GUI.</p> <p>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.</p> <p>Edit: Just to add this in, I have also tried:</p> <pre class="lang-cs prettyprint-override"><code> private void frmAppLogin_Load(object sender, EventArgs e) { this.WindowState = FormWindowState.Normal; } </code></pre> <p>Which didn't help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload