If statements for Checkboxes

前端 未结 6 1131
刺人心
刺人心 2021-02-18 23:43

I wanted to know how to write if statements to see if one or another check box is checked or not.

I have two check boxes. I wanted it to check to see if checkbox 1 is c

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-19 00:14

    I'm making an assumption that you mean not checked. I don't have a C# compiler handy but:

    if (checkbox1.Checked && !checkbox2.Checked)
    {
    
    }
    else if (!checkbox1.Checked && checkbox2.Checked)
    {
    
    }
    

提交回复
热议问题