RadioButton.Checked Error: Control.Checked cannot appear on the left hand side of += or -=

前端 未结 3 1064
北荒
北荒 2021-01-06 17:21

I am having the strangest problem, and I have to be missing something.

Here is my code that is causing the error.

if (radLot.Checked == true)
{
    S         


        
3条回答
  •  Happy的楠姐
    2021-01-06 18:15

    Alternative you can check the CheckState to perform your statement.

     if (radLot.CheckState == CheckState.Checked)
                {
    
                }
    

    Edit: This will only work when writing a winform application. It will not work with WPF. Use Douglas' answer for WPF.

提交回复
热议问题