G
Guest
I have simple app with a textBox, a button and errorProvider. I have all the
controls CausesValidation set to true, and the following code:
private void textBox1_Validation(object sender, CancelEventArgs e)
{
string error = null;
if( textBox1.Text.Length == 0 )
{
error = "Please enter a name";
e.Cancel = true;
}
errorProvider1.SetError((Control)sender, error);
}
This event fails to fire even though I tab over to another control without
putting anything in the textbox. I've researched the internet and have come
up empty. Does anyone know whether there is something that I am failing to
do. Thanks
controls CausesValidation set to true, and the following code:
private void textBox1_Validation(object sender, CancelEventArgs e)
{
string error = null;
if( textBox1.Text.Length == 0 )
{
error = "Please enter a name";
e.Cancel = true;
}
errorProvider1.SetError((Control)sender, error);
}
This event fails to fire even though I tab over to another control without
putting anything in the textbox. I've researched the internet and have come
up empty. Does anyone know whether there is something that I am failing to
do. Thanks