First, the login form:
Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. LINQ; using system. text; using system. windows. forms; namespace windowsformsapplication1 {public partial class frmlogin: FORM {public frmlogin () {initializecomponent ();} private void frmlogin_load (Object sender, eventargs e) {} form frmmain; private void button#click (objec T sender, eventargs e) {// requirement: In the login form, assume that when the user enters the Account "zhangsan" and the password is "123" (the password is displayed *) //, destroy the logon form and open the main form. Otherwise, an error message is displayed, such as "incorrect account or password" If (textbox1.text. equals ("zhangsan") & textbox2.text. equals ("123") {frmmain = new frmmain (); frmmain. show ();} else {MessageBox. show ("your account or password is incorrect") ;}} private void textbox=textchanged (Object sender, eventargs e) {} private void textbox2_textchanged (Object sender, eventargs e ){}}}
Next is the main form:
Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. LINQ; using system. text; using system. windows. forms; namespace windowsformsapplication1 {public partial class frmmain: FORM {public frmmain () {initializecomponent ();} private void frmmain_load (Object sender, eventargs E) {} private void file toolstripmenuitem_click (Object sender, eventargs e) {} private void Open main form 1toolstripmenuitem_click (Object sender, eventargs E) {frm subform 1 F = new frm subform 1 (); F. show (); F. mdiparent = This;} private void open the main form 2toolstripmenuitem_click (Object sender, eventargs e) {foreach (VAR item in this. mdichildren) {item. dispose ();} frm subform 2 F1 = new frm subform 2 (); f1.show (); f1.mdiparent = This;} private void frmmain_load_1 (Object sender, eventargs E) {}}}
The last two subforms
Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. LINQ; using system. text; using system. windows. forms; namespace windowsformsapplication1 {public partial class frm subform 1: FORM {public frm subform 1 () {initializecomponent ();} private void frm subform upload load (Object sender, eventargs e ){}}}
Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. LINQ; using system. text; using system. windows. forms; namespace windowsformsapplication1 {public partial class frm sub-Form 2: FORM {public frm sub-Form 2 () {initializecomponent ();} private void frm sub-form 2_load (Object sender, eventargs e ){}}}