Ever want to do some error notification in your application using .NET that looks like this?

Using an ErrorProvider object, you can. In VIsual Studio, just drag the ErrorProvider from the list of components to your container form. There should be only one ErrorProvider per form. I do not see any reason why you need to have 2 or more.

Supposing you have a TextBox named textBox1 and an ErrorProvider object named errorProvider1. You could place this code inside your class constructor

add this method within your class.

This code activates the validation when the TextBox object loses focus. If for example you wish to execute validation when the LOGIN button is clicked, you can use the ValidateChild() method of the container class.

Related Posts Plugin for WordPress, Blogger...