Let's think about a small program that has a form and two panels. There is a menu strip at the top and under the "File" menu there are 2 options: "New Form" and "Admin" (and "Quit"). There are 60 fields in different groupboxes in panel1 (a detailed registration form). A new form, panel1, is automatically shown when program is run. From the file menu, when user clicks "admin" option, panel1 should disappear and panel2 should become visible. Since both panels have common fields and functions to control/restrict input, I think I should use the same form. My current algoritm is as follows:
* When "New Form" is clicked:
- if panel1 is current one: clear every field in panel1
- if panel2 is current one: clear every field in panel2, hide panel2, show panel1
* When "Admin" is clicked:
- if panel1 is current one: clear every field in panel1, hide panel1, show panel2
- if panel2 is current one: clear every field in panel2
Is this mechanism correct or what is the best way to switch between different forms/panels in C#?