0

how to do this? I only know how to set the error

errorprovider.seterror(textbox, "message);

remove the error

error.provider.seterror(textbox, "");

But instead of just removing the error, I want to display something like a check mark.

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Rash1988
0

The errorProvider only has one icon which is displayed against all controls which have an error text set so you couldnt show a tick for some controls and a cross for others withthe same errorProvider. One option would be to have two errorProviders. Use one to show errors and the other to show correct values. Something like:

if(textBox.Text != "") //if data valid
{
    errorProviderValid.SetError(textBox, "Input Valid");
    errorProviderInValid.SetError(textBox, "");
}
else
{
    errorProviderValid.SetError(textBox, "");
    errorProviderInValid.SetError(textBox, "Cannot be blank");
}

Then set the icon of errorProviderValid to a tick icon and leave errorProviderInvalid with the default cross icon.

0

In the designer you can change the Icon property. Create/download a suitable tick icon and set assign it to your Valid error provider. I'd also recommend setting the BlinkStyle property to NeverBlink since it will look unsightly and possibly confusing if all your ticks are flashing when input is valid.

Edited by Geekitygeek: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.