DotNetWebTutor.com                                                    Link to Us

Errorprovider
Displays icons and error messages for controls with problems

  • Start a new project
  • Add a textbox and a button
  • Add an errorProvider control

It is a Nonvisual control
errorprovider control in vb tray

  • Add this code to the validating event

If TextBox1.Text <> "OpenSaysAMe" Then
ErrorProvider1.SetError(TextBox1, "Wrong password")
End If

example of using errorprovider control in vb

To use errorProvider control:
call seterror and pass name of control with the error and the error message

at runtime, an error icon is displayed next to the control and a pop up tooltip over the icon

This is a better way to give user feedback

1