C#控件儲備——錯誤提示控件errorProvider


錯誤提示控件errorProvider

 

VS顯示:

 

核心代碼:

this.errorProvider1.SetError(this.textBox1,"輸入有誤");

源碼:

 1 #region 錯誤提醒ErrorProvider
 2         private void button1_Click(object sender, EventArgs e)
 3         {
 4             if (textBox1.Text != "")
 5             {
 6                 this.errorProvider1.SetError(this.textBox1,"輸入有誤");
 7                 DialogResult ReturnDlg = MessageBox.Show(this, "輸入有誤,是否重新輸入", "信息提示", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question);
 8                 switch (ReturnDlg)
 9                 {
10                     case DialogResult.Retry:
11                         this.textBox1.Text = "";
12                         break;
13                     case DialogResult.Cancel:
14                         break;
15                 }
16             }
17         }
18         #endregion


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM