Have VB.Net 2010 ErrorProvider Fire on Tabbing Out of BindingSource TextBox on a WinForm
- by OneSource
I have a TextBox control on a Windows Form that uses a DataSource custom object as its BindingSource. I have associated an ErrorProvider with the BindingSource like so:
Dim dobExample As New DOExample
ExampleBS.DataSource = dobExample
epExample.DataSource = ExampleBS
The ErrorProvider fires if I type a blank space in the TextBox and then press Tab to move to the next control, which is correct. But it doesn't fire if I just press Tab without entering anything. I want the ErrorProvider to show the Error, even if the TextBox is empty and not just validate when there is text in the TextBox. How do I accomplish this?
As an additional bit of info, when I execute the following statement:
epDOContact.GetError(TextBox)
an empty string is returned even though the TextBox is empty when it is required to be present.