//Close private void ExitButton_Click(object sender, EventArgs e) { mainform.Invoke((MethodInvoker)(() => this.Enabled = false)); Close(); }