Have VB.Net 2010 ErrorProvider Fire on Tabbing Out of BindingSource TextBox on a WinForm
Posted
by OneSource
on Stack Overflow
See other posts from Stack Overflow
or by OneSource
Published on 2010-06-11T12:03:57Z
Indexed on
2010/06/11
12:42 UTC
Read the original article
Hit count: 380
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.
© Stack Overflow or respective owner