Let's approach logically. If there are only two forms, and you want to close both, it means you want to exit the application. Now, one of the forms is a main one; it it defined when
Application.Run
is called. The form used as an argument becomes main. If you close a main form application exist anyway. You only need to take care about your second form.
Overrides its virtual
OnFormClosed
method:
protected override void OnFormClosed(FormClosedEventArgs e) {
Application.Exit();
}
—SA