private void ErrorWindow_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals(Keys.Escape)) { DiscardButton.PerformClick(); } }