本文介绍了复选框不是一键签入,也不是一键注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在复选框中使用此代码,但使用此代码后,我的复选框无法正常工作.就像一键未选中一样,选中后也不会一键取消.
请帮助我.............



hello ,I''m using this code in the checkbox but after use this,my checkbox is not work properly like. Like it is not checked in one click and after checked it is not unchecked in one click.
please help me.............



private void checkBox4_CheckedChanged(object sender, EventArgs e)
        {

 if (checkBox4.Checked == true)
            {
                panel1.Show();
                radioButton1.Show();
                radioButton2.Show();
                radioButton3.Show();
                radioButton9.Show();
                radioButton8.Show();

}
}

推荐答案

checkBox4.Checked=true;


从If


from inside the If



private void checkBox4_CheckedChanged(object sender, EventArgs e)
        {

 if (checkBox4.Checked == true)
            {
                panel1.Show();
                radioButton1.Show();
                radioButton2.Show();
                radioButton3.Show();
                radioButton9.Show();
                radioButton8.Show();

                //checkBox4.Checked=true; remove this line
}
}



在检查条件为true之后,您再次将checkbox的状态定义为true ..似乎是问题,尝试将checked状态设置为false或无需再​​次声明checkbox的状态..
快乐的编码:-)



after checking the condition with true you are again defining the state of checkbox to true.. seems to be the problem try it out with checked state as false or no need to declare again state of checkbox..
happy coding:-)


这篇关于复选框不是一键签入,也不是一键注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 14:26