private void Cancel_Click(object sender, EventArgs e) { foreach (Control control in panel1.Controls) { IOptions options = control as IOptions; if (options != null) { options.Cancel(); } } DialogResult = DialogResult.Cancel; }