c#errorprovider控件基本使用随笔

来源:互联网 发布:淘宝怎样才能分期付款 编辑:程序博客网 时间:2024/06/18 10:42

核心: this.errorProvider1.SetError(this.username, "Please input your username!");             

bool  flag = true;

            #region errorprovider
            if (username.Text.Trim() == string.Empty)
            {
                this.errorProvider1.SetError(this.username, "Please input your username!");
                flag = false;
            }
            else if (password.Text.Trim() == string.Empty)
            {
                this.errorProvider1.SetError(this.password, "Password can not be empty!");
                flag = false;
            }
            else if (password.Text.Length != 8)
            {
                this.errorProvider1.SetError(this.password, "The length of Password must be eight!");
                this.password.Text = "";
                flag = false;
            }
0 0
原创粉丝点击