form1.cs

来自「图书管管理,输入学生的编号可显示学生的借书情况」· CS 代码 · 共 53 行

CS
53
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace booklibary
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int i = 3;
        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
        }

        private void button2_Click(object sender, EventArgs e)
        {
             string name=textBox1 .Text.ToString ();
             string password = textBox2.Text.ToString();
            
             if (name == "lihua" && password == "123")
             {
                 MessageBox.Show("欢迎进入图书馆系统!");
                 Form2 secendform = new Form2();
                 secendform.Show();
                 this.Hide();
             }
             else
             {
                i--;
                 MessageBox.Show("用户名或密码错误请重输!");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 if (i <= 0)
                 {
                     MessageBox.Show("对不起,此为非法用户!");
                     this.Close();
                 }
             } 
             
        }
      
       
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?