日期:2014-05-18  浏览次数:21050 次

radioButton1.Checked==true 出错?
C# VS2005
运行 radioButton1.Checked==true
时报错:只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句
而 bool test=radioButton1.Checked 又能正常执行。

------解决方案--------------------
在判断语句中吗?
为什么是两个等号?
如果是在判断语句中,不要后面的试试:
if(radioButton1.Checked)
{

}
------解决方案--------------------
赋值语句有问题

1. button.checked = true;

2. if(button.checked == true)
{
}
------解决方案--------------------
要赋值的话,radionButton1.Checked=true;
要判断当前值:if(radioButton1.Checked)
------解决方案--------------------
RadioButton的Checked属性
C# code

        //
        // 摘要:
        //     获取或设置一个值,该值指示是否已选中控件。
         //
        // 返回结果:
        //     若选中了复选框,则为 true;反之,则为 false

------解决方案--------------------
顶一下
------解决方案--------------------
判断语句用 ==

你想赋值的话,用 =

把你的语句改成

radioButton1.Checked=true 



if(radioButton1.Checked==true ){}

就没错

建议看下编程的基础书籍。
------解决方案--------------------
radioButton1.Checked=true
------解决方案--------------------
只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句
很明显 radioButton1.Checked==true; 不能作为单一语句