I have to show an icon to the user if the pressed/typed any wrong characters, so i'm using error_provider.
In my case, the error_provider is not disappearing, if it's a valid number in the textbox. What is the misatek here??
string text = t_LongitudeRadTextBox.Text;
bool hasDigit = text.Any(letter => Regex.IsMatch(t_LongitudeRadTextBox.Text, "^[0-9]$"));
// Call SetError or Clear on the ErrorProvider.
if (!hasDigit)
{
errorProvider1.SetError(t_LongitudeRadTextBox, "Needs to contain a digit");
}
else
{
errorProvider1.Clear();
}
Calling
errorProvider1.Clear();
isn't enough as stated in the docs you need to give it an empty string. LikeSetError(t_LongitudeRadTextBox, "")