Close the main process and popup unique forms

Source: Internet
Author: User

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespacewindowsformsapplication8{ Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); }        Private voidtextBox1_TextChanged (Objectsender, EventArgs e) {        }        Private voidButton1_Click (Objectsender, EventArgs e) {            if(TextBox1.Text = ="Feng"&& TextBox2.Text = ="123") {Form2 F2=NewForm2 ( This); F2.                Show ();  This.            Hide (); }            Else{MessageBox.Show ("wrong input! "); return; }        }    }}

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespacewindowsformsapplication8{ Public Partial classform2:form {Form1 F1;  PublicForm2 (Form1 F1)//Form Pass -through value{InitializeComponent (); F1=F1; }        Private voidForm2_formclosed (Objectsender, Formclosedeventargs e) {F1. Close ();//when the Form2 is closed, Form1 shuts down simultaneously.} List<Form> list =NewList<form>(); Private voidButton1_Click (Objectsender, EventArgs e) {            BOOLhas =false; FORM3 f3=NewFORM3 ( This); F3. Owner= This; foreach(Form Finchlist) {                if(F.name = = F3. Name)//determine if the form is available{ has=true;//If you have the form, recordF.windowstate = Formwindowstate.normal;//form start General sizeF.show ();//Existing forms displayF3. Close ();//The new form closesF.activate ();//Activate the form and assign it to the form                }            }            if(Has = =false)//If the form is not{F3. Show ();//Create a form that displays a form3List. Add (F3);//add a form3 form into the list collection            }        }        //when the Form3 form is closed, the Form3 form is removed from the list collection         Public voiddeleteform3 (Form3 f3) {List<Form> aa=NewList<form>(); foreach(Form Finchlist) {                if(f.name!=F3. Name) {aa.                ADD (f); }} List=AA; }    }}

usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespacewindowsformsapplication8{ Public Partial classform3:form {Form2 F2;  PublicForm3 (Form2 F2) {InitializeComponent (); F2=F2; }        Private voidForm3_formclosing (Objectsender, FormClosingEventArgs e) {F2.DELETEFORM3 ( This);//Remove FORM3 Form        }    }}

Close the main process and popup unique forms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.