If one checkbox is checked, set the other to unchecked

前端 未结 9 1717
Happy的楠姐
Happy的楠姐 2021-01-13 10:06

I have two checkboxes on my form; chkBuried and chkAboveGround. I want to set it up so if one is checked, the other is unchecked. How can I

9条回答
  •  独厮守ぢ
    2021-01-13 10:57

    This will work for two unchecked boxes, since they are already unchecked it is simpler.
    I had to do this myself also.

    private void customer_IsCheckedChanged(object sender, EventArgs e)
    {
        business.IsChecked = false;
    }
    
    private void business_IsCheckedChanged(object sender, EventArgs e)
    {
        customer.IsChecked = false;
    }
    

提交回复
热议问题