c#errorprovider控件基本使用隨筆

核心: 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;
            }
發佈了37 篇原創文章 · 獲贊 20 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章