Hi, I have one problem. I validate two texboxs. If texbox are not validate I show error message with error provider.
Situation :
tbAzetId.Text="string"; tbHeslo.Text=empty;
errorprovider show error message in tbHeslo, this is ok.
Then I write some text in tbHeslo, click on button but errorprovider is still show error message in tbHeslo. Where can be problem?
Code is here:
private bool IsAzetIdValid()
{
if (tbAzetId.Text!=String.Empty && Regex.IsMatch(tbAzetId.Text, "[^a-zA-Z0-9]"))
{
return true;
}
else
{
return false;
}
}
private bool IsHesloValid()
{
if (tbHeslo.Text !=String.Empty)
{
return true;
}
else
{
return false;
}
}
private void btnPrihlasenie_Click(object sender, EventArgs e)
{
errorProvider.Clear();
if (!IsAzetIdValid())
errorProvider.SetError(tbAzetId, @"Nezadali ste Azet ID");
else if (!IsHesloValid())
errorProvider.SetError(tbHeslo, @"Nezadali ste heslo");
else
Text = "OK";
}