First, there are not parent and child forms; there are owned and owner's form. If you don't know that it means you don't use this relationship, but you should. Make all non-modal non-main form owned by the main one; it is important for application activation integrity (try it with activation and you will see the great difference). Use
System.Windows.Forms.Form.Owner
for all non-main forms; also use
Form.ShowInTaskbar = false
for all owned forms — very useful.
Now, what is processing you want to halt? What is "form is executed"? There is no such notion. Shown? Modal or not? As to "control" returns back to the
parent [owner — SA] form" — it happens by itself, but you should use ownership relationship, see the previous paragraphs. Final question is: do you want to show the owned form after closing ever again? Is so, you need to hide it instead of closing and show again when you need it. Another option is using it in a modal way, via
Form.ShowDialog
.
Hiding technique looks like this:
using System.Windows.Forms;
protected override void OnClosing(FormClosingEventArgs e) {
if (e.CloseReason == CloseReason.UserClosing) {
this.Hide();
e.Cancel = true;
}
}
—SA