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 Form1 : Form { public Form1() { InitializeComponent(); } private void button3_Click(object sender, EventArgs e) { string name = "wangyueshuo"; string _password = "123456"; label5.Text = ""; label6.Text = ""; if (textBox1.Text == "") { label5.Text = "请输入你的账号"; return; } if (textBox2.Text == "") { label6.Text = "请输入你的密码"; return; } if (textBox1.Text ==name&&textBox2.Text==_password) { label4.ForeColor = Color.Green; label4.Text = "登陆成功,请稍后..."; } else { label4.ForeColor = Color.Red; label4.Text = "密码或账号错误"; } } } }
标签:登录,textBox1,Text,label4,System,密码,using From: https://www.cnblogs.com/wangyueshuo/p/18261895