网站域名备案变更,电商网站开发人员结构,云瓣科技做网站,建网站是自己做还是用CMS创建一个Windows登录程序#xff0c;创建两个窗体#xff0c;一个用来登录#xff0c;一个为欢迎窗体#xff0c;要求输入用户名和密码#xff08;以个人的姓名和学号分别作为用户名和密码#xff09;#xff0c;点击【登录】按钮登录#xff0c;登录成功后显示欢迎窗体…创建一个Windows登录程序创建两个窗体一个用来登录一个为欢迎窗体要求输入用户名和密码以个人的姓名和学号分别作为用户名和密码点击【登录】按钮登录登录成功后显示欢迎窗体。点击【退出】按钮关闭程序
提示使用PasswordChar属性设置TextBox的密码输入。
快捷键直接在Button的Text后面加字母如L则使用ALTL即可
扩展用户名或密码错误则显示“用户名或密码错误”提示框用MessageBox。并且规定用户错误输入不超过3次否则直接退出。
public partial class Form1 : Form { int i 0; int MaxLoginAttempts 3; string correctUsername admin; string correctPassword 001; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text ! correctUsername textBox2.Text ! correctPassword) { MessageBox.Show(用户名或密码错误, 登录失败, MessageBoxButtons.OK, MessageBoxIcon.Error); i; if (i MaxLoginAttempts) { MessageBox.Show(您已被锁定请稍后再试。, 登录失败, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show(登录成功, 登录成功, MessageBoxButtons.OK, MessageBoxIcon.Information); Form2 login new Form2(); login.Show(); } } private void button2_Click(object sender, EventArgs e) { this.Close(); }