ErrorProvider 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 Form.
Code:
Write code on Button click event.
Double click on Click event.
private void btnSubmit_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")//condition is given so that empty textbox could not save
{
errorProvider1.SetError(textBox1, "Cannot leave textbox blank");
//error text will show as tooltip
}
else
errorProvider1.SetError(textBox1, "");
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.
ErrorProvider Property:
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
Anonymous User
05-Apr-2019Thanks for the informative post.
parag patel
09-Nov-2012how can hide
i creat dll then open in notpad [ YException Exception Show .cctor #d : \ \ l o c a l h o s t . d l l r ]
how can hide this pls help k_info108@yahoo.com