|Visual Basic (Declaration)|
Public Event UserError() As UserErrorEventHandler
|Visual Basic (Usage)||Copy Code|
public event UserErrorEventHandler UserError()
This event occurs when the user, code, or a database tries to provide invalid data to a control. The event can occur in a number of situations, such as when the user types an invalid character or tries to type a value that is out of range. Which values are invalid or out of range depends on the control type and the settings of their properties.
If you prefer that the control does not validate data as it is provided to the control, set the UserEntry property to FreeFormat.
Contrast this event with the InvalidData event. The UserError event may occur while the user is working in the control; for example, the user may try to type a letter into a control that is defined to allow only numbers. The InvalidData event occurs when the data in the control is validated as the focus leaves the control.