资源简介
C#实现点击菜单栏在原页面显示不同子菜单内容,不会弹出新窗口。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DormitoryBLL;
using DormitoryModel;
using IDormitoryBLL;
namespace Dormitory
{
public partial class FrmRegister : Form
{
private IUserBLL Iuserbll = new UserBLL();
public FrmRegister()
{
InitializeComponent();
label5.Visible = false;
label6.Visible = false;
label8.Visible = false;
label9.Visible = false;
}
///
/// 注册事件
///
///
///
private void button1_Click(object sender EventArgs e)
{
if(txtUserName.Text.Trim()==null||txtUserName.Text.Trim()==““)
{
label5.Text = “用户名不允许为空“;
label5.Visible = true;
return;
}
if(txtPwd.Text.Trim() != txtpwds.Text.Trim())
{
label6.Text = “两次密码不一致“;
label6.Visible = true;
return;
}
if(txtPhone.Text.Trim()==null||txtPhone.Text.Trim()==““)
{
label9.Text = “电话不允许为空“;
label9.Visible = true;
return;
}
User user = new User();
user.UserName = txtUserName.Text.Trim();
user.UserPwd = txtpwds.Text.Trim();
user.Phoner =Convert.ToInt64(txtPhone.Text.Trim());
int users = Iuserbll.InsertUser(user);
if(users>0)
{
MessageBox.Show(“注册成功“);
}
else
{
MessageBox.Show(“注册失败“);
}
}
///
/// 获得焦点事件
///
///
///
private void txtPwd_Enter(object sender EventArgs e)
{
if (txtUserName.Text.Trim() == ““ || txtUserName.Text.Trim() == null)
{
label5.Text = “用户名不允许为空“;
return;
}
else
{
User user = Iuserbll.GetUserName(txtUserName.Text.Trim());
if (user == null)
{
label5.Visible = false;
return;
}
else
{
label5.Visible = true;
}
}
}
///
/// 电话文本框获得焦点事件
///
///
///
private void txtPhone_Enter(object sender EventArgs e)
{
if(txtPwd.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 23826432 2015-12-17 17:48 DevExpress_VCL_15.2.2_Full_Source_XE10.1_Berlin\ExpressTile Control\Demos\Data\Homes.mdb
----------- --------- ---------- ----- ----
0 0
- 上一篇:C#医院管理系统源码 (CS架构)
- 下一篇:c#QQ聊天系统
评论
共有 条评论