How to use ErrorProvider in VB.NET

Error Provider is a cool control which provides visual indications of any errors which you catch.

eg. If you have a text box which is supposed to captured the names of people and if someone leaves it blank you can use Error Provider to provide a visual indication of the error.



Here is a video  to explain the use of the error provider.

Here is a quick sample of how to use the error provider in


If Len(me.txtName.Text) > 50 Then
                Me.ErrorProvider1.SetError(me.txtName, “First Name can not be more than 50 chars”)
                Me.ErrorProvider1.SetError(me.txtName, “”)
End If