Can a checkbox be validated with errorprovider?

0

I have 2 checkboxes one to select "YES" and another to select "NO", I have validated some controls like textbox or combobox with the ErrorProvider control, I wonder if that validation can be done with a checkbox so that the symbol of error next to the control, what I want is to avoid the MessageBox to make it more user friendly.

    
asked by Aetos2501 19.04.2018 в 18:43
source

1 answer

0

Of course you can, but for the case you raise, you should use a RadioButton control if you only have two options and only one is required at the same time.

But here is an example of validation with CheckBox :

if (checkBox1.Checked == false)
     errorProvider1.SetError(checkBox1, "Requiere Selección.");
else
    errorProvider1.Clear();
    
answered by 19.04.2018 в 20:12