7.WinFor练习--用户登录

发布时间:2020-08-02 10:22:28 作者:初禾
来源:网络 阅读:353

namespace _7用户登录
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//点击登录时进行判断
private void btnLoging_Click(object sender, EventArgs e)
{
if (radStudent.Checked || radTeacher.Checked)
{
//取得输入用户名和密码
string name = txtName.Text.Trim();
string pwd = txtPwd.Text;
//判断学生登录还是老师登录
if (radStudent.Checked)
{
if (name == "student" && pwd == "student")
{
MessageBox.Show("学生登录成功");
}
else
{
MessageBox.Show("学生登录失败");
txtName.Clear();
txtPwd.Clear();
txtName.Focus();
}
}
else
{
if (name == "teacher" && pwd == "teacher")
{
MessageBox.Show("老师登录成功");
}
else
{
MessageBox.Show("老师登录不成功");
txtName.Clear();
txtPwd.Clear();
}
}
}
else
{
MessageBox.Show("请先选择用户登录身份");
}
}
}
}

推荐阅读:
  1. Python的练习项目
  2. SHELL脚本练习

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

单选控件的使用 fo

上一篇:Windows平台下忘记Oracle登陆密码解决办法

下一篇:报表实时显示时间

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》