Note that there are some explanatory texts on larger screens.

plurals
  1. POClosing Form with windows 'X' Button
    primarykey
    data
    text
    <p>My program wasn't exiting when 'X' was clicked so when I looked it up I got this code.</p> <pre><code>protected override void OnFormClosing(FormClosingEventArgs e) { Application.Exit(); } </code></pre> <p>but this interferes with the <code>this.Close()</code> method.</p> <p>Is there a way to just use this code when the 'X' is clicked and not when the Form is actually closing? This seems to be the only Form having the problem?</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace PassMan { public partial class Passwords : Form { String[,] UandS = { { "Russell", "Hickey" }, { "Junior", "Russ" } }; public Passwords() { InitializeComponent(); for (int i = 0; i &lt; UandS.Length / 2; i++) { for (int j = 0; j &lt; 2; j++) { if (j % 2 == 0) { tbUsernames.Text = tbUsernames.Text + UandS[i, j] + "\r\n"; } else { tbPasswords.Text = tbPasswords.Text + UandS[i, j] + "\r\n"; } } } tbPasswords.PasswordChar = '*'; } private void btnSH_Click(object sender, EventArgs e) { Properties.Settings.Default.Save(); if (btnSH.Text == "Show Passwords") { btnSH.Text = "Hide Passwords"; tbPasswords.PasswordChar = (char)0; } else { btnSH.Text = "Show Passwords"; tbPasswords.PasswordChar = '*'; } } private void btnClose_Click(object sender, EventArgs e) { Application.Exit(); } private void btnLogin_Click(object sender, EventArgs e) { fLogin main = new fLogin(); main.Show(); this.Close(); } protected override void OnFormClosing(FormClosingEventArgs e) { //Application.Exit(); } } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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