⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formregistnewuser.cs

📁 基本实现了功能
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Financial
{
    /// <summary>
    /// 注册新用户的窗体
    /// </summary>
    public partial class FormRegistNewUser : Form
    {
        public FormRegistNewUser()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_OK_Click(object sender, EventArgs e)
        {
            if (this.textBox_UserName.Text.Trim().Length == 0)
            {
                this.label_Info.ForeColor = Color.Red;
                this.label_Info.Text = "用户名不能为空";
                return;
            }

            if (!this.textBox_Psw.Text.Equals(this.textBox_Psw2.Text))
            {
                this.label_Info.ForeColor = Color.Red;
                this.textBox_Psw.Clear();
                this.textBox_Psw2.Clear();
                this.label_Info.Text = "您两次输入的密码不一致";
                return;
            }

            foreach (User u in UserManager.UserList)
            {
                if (u.UserName.Equals(this.textBox_UserName.Text.Trim()))
                {
                    this.label_Info.ForeColor = Color.Red;
                    this.label_Info.Text = "该用户名已经被其他用户使用,请使用其他用户名";
                    return;
                }

            }


            this.DialogResult = DialogResult.OK;
        }

        /// <summary>
        /// 取消
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}

⌨️ 快捷键说明

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