Hide the form, open the form and if you want it to be hidden, and then show it, you can tell if it's null or not, or if it's closed, or new, or show it.
Of course, if there are hidden words to quit when it is best to use Application.exit () to close the program.
Form fh; Private void button6_click (object sender, EventArgs e) { ifnull | | FH. isdisposed) { new Form9 (); = F9; F9. Show (); } Else { fh. Show (); }
Another situation is to hide the parent form when the subform is opened, to show the parent form when the subform is closed, to use someone else's code, I don't have a test, it should mean the same thing.
Using the modal dialog box ShowDialog open Form B, when form B is closed, it is necessary to return a DialogResult, default to None, similar to OpenFileDialog and SaveFileDialog in the button click event of form a
private void Form2_formclosing (object sender, FormClosingEventArgs e) {
This. Close (); This. DialogResult = DialogResult.OK;
C #. NET Hidden Forms