1 Hidden method, the principle is to hide the old window, and then open a new window.
Create a new NewForm window (NewForm is your own defined form) NewForm fm=new NewForm ()
This. Hide ();//hidden now this window FM. Show ();//New window appears
This way the old window will still account for the memory, so if used to do landing window is not very good, but if the old window is still need to restore the main window, this method is very good, because you can close the new window, and then use the old window. Show () Can restore the old window. So this method is suitable for passing information between the main window and the child window.
2, come again is the method for the login window design. In Program.cs this defines:
static void Main () {application.enablevisualstyles (); Application.setcompatibletextrenderingdefault (FALSE);
New Login window (login is your own definition of form) login Log = new Login ();
Use the modal dialog box method to display the Log log.showdialog ();
DialogResult is used to determine whether to return the parent form's if (Log.dialogresult = = DialogResult.OK) {//Open main form Application.Run in thread (new Main ());}} After verification is completed in the login window, assign the value Log.dialogresult = DialogResult.OK. The login window will be turned off after completing the task, and the main window will open.
Close the first Form window in C # and open another new window method