[Solved] Error on if statement when using unchecked


try this:

if (Catz.Checked)
{
    // do whatever
}

If I understood you correctly and Catz is a CheckBox then the property you
are looking for is probably Checked. This can be true or false
In an if statement you can use the bool variable without a comparison operator like “==”

to check for the opposite use the “!” negation operator:

// if UNCHECKED / NOT CHECKED
if (!Catz.Checked)
{
    // do whatever
}

0

solved Error on if statement when using unchecked