private void button1_Click(object sender, EventArgs e) { if (theDialog.Visible) { theDialog.BringToFront(); } else { theDialog.ShowDialog(); } }