public PromptForm() { InitializeComponent(); AutoSize = true; FormClosing += delegate(object sender, FormClosingEventArgs args) { bool valid = true; if (ValidateInput != null) { foreach (var d in ValidateInput.GetInvocationList()) { valid = (bool)d.DynamicInvoke(); if (!valid) { break; } } } bool cancel = DialogResult != DialogResult.Cancel && !valid; if (cancel) { args.Cancel = true; SystemSounds.Beep.Play(); } }; MinimumSize = new Size(400, 150); }