Error Provider Window Application in C#.Net

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Linq;  
  7. using System.Text;  
  8. using System.Threading.Tasks;  
  9. using System.Windows.Forms;  
  10. using System.Diagnostics;  
  11. using System.ComponentModel;  
  12. using System.Text;  
  13.   
  14. namespace Error2  
  15. {  
  16.     public partial class Form1 : Form  
  17.     {  
  18.   
  19.         public Form1()  
  20.         {  
  21.             InitializeComponent();  
  22.         }  
  23.   
  24.         private void button1_Click(object sender, EventArgs e)  
  25.         {  
  26.             if (textBox1.Text == "krishna")  
  27.             {  
  28.                 errorProvider1.Clear();  
  29.                 MessageBox.Show("This is Valid Data");  
  30.                   
  31.             }  
  32.             else  
  33.             {  
  34.                 errorProvider1.SetError(textBox1,"please enter correct data");  
  35.                 MessageBox.Show("please enter correct data");  
  36.                 errorProvider1.BlinkStyle = ErrorBlinkStyle.BlinkIfDifferentError;  
  37.   
  38.             }  
  39.         }  
  40.     }  
  41. }