ErrorProvider Control in C#.Net
simplifies and streamlines error presentation. It is an abstraction that
shows errors on your form. It does not require a lot of work on your part. This
is its key feature.
How to use ErrorProvider Control
Drag and drop
ErrorProvider ,TextBox and Button control from toolbox on the window
Write code on Button click event.
Double click on Click event.
btnSubmit_Click(object sender, EventArgs e)
(textBox1.Text == "")//condition is given so that empty
textbox could not save
"Cannot leave textbox blank");
//error text will show as tooltip
label3.Text = "Entered name is " + textBox1.Text;
Run The Project
If textbox is empty and Submit button
is clicked then error icon will display.
When name is entered in textbox and
Submit button clicked then entered name will show in Label.
Icon property: which
allows us to set an icon that will be display when error occurred?
BlinkRate property: which
allows setting the rate in milliseconds at which the icon blinks.
Icon: Set the Icon that is displayed next to a
control when an error occurred.
BlinkStyle: Gets or sets a value
indicating when the error icon flashes