01windows Forms program learning, 01windows Forms Program

Source: Internet
Author: User

01windows Forms program learning, 01windows Forms Program

1 2 3 static user name and password logon Exercise 4 5 private void button2_Click (object sender, EventArgs e) 6 {7 8 textUser. text = Convert. toString (textUser. text); 9 textBox2.Text = textBox2.Text. toString (); 10 if (textUser. text = "admin" & textBox2.Text = "111111") 11 {12 MessageBox. show ("Logon successful"); 13} 14 else15 {16 MessageBox. show ("Incorrect username or password"); 17} 18 19} 20 21 22 23 form close message tip Exercise 24 25 private void Form2_FormClosing (object sender , FormClosingEventArgs e) 26 {27 DialogResult re = MessageBox. Show ("are you sure you want to disable it? "," Message ", MessageBoxButtons. yesNo); // whether to disable the message prompt box 28 if (re = DialogResult. no) 29 {30 e. cancel = true; // close 31} 32 else33 {34 e. cancel = false; // do not close 35} 36} 37 38

 

Related Article

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.